Deprecated: Return type of WPCF7_FormTag::offsetExists($offset) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/superte1/themesbyte.com/wp-content/plugins/contact-form-7/includes/form-tag.php on line 542

Deprecated: Return type of WPCF7_FormTag::offsetGet($offset) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/superte1/themesbyte.com/wp-content/plugins/contact-form-7/includes/form-tag.php on line 528

Deprecated: Return type of WPCF7_FormTag::offsetSet($offset, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/superte1/themesbyte.com/wp-content/plugins/contact-form-7/includes/form-tag.php on line 516

Deprecated: Return type of WPCF7_FormTag::offsetUnset($offset) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/superte1/themesbyte.com/wp-content/plugins/contact-form-7/includes/form-tag.php on line 552

Deprecated: Return type of WPCF7_Validation::offsetExists($offset) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/superte1/themesbyte.com/wp-content/plugins/contact-form-7/includes/validation.php on line 129

Deprecated: Return type of WPCF7_Validation::offsetGet($offset) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/superte1/themesbyte.com/wp-content/plugins/contact-form-7/includes/validation.php on line 117

Deprecated: Return type of WPCF7_Validation::offsetSet($offset, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/superte1/themesbyte.com/wp-content/plugins/contact-form-7/includes/validation.php on line 98

Deprecated: Return type of WPCF7_Validation::offsetUnset($offset) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/superte1/themesbyte.com/wp-content/plugins/contact-form-7/includes/validation.php on line 139

Deprecated: Implicit conversion from float 1.0E+19 to int loses precision in /home/superte1/themesbyte.com/wp-includes/class-wp-hook.php on line 76

Deprecated: Implicit conversion from float 1.0E+19 to int loses precision in /home/superte1/themesbyte.com/wp-includes/class-wp-hook.php on line 78

Deprecated: Implicit conversion from float 1.0E+19 to int loses precision in /home/superte1/themesbyte.com/wp-includes/class-wp-hook.php on line 76

Deprecated: Implicit conversion from float 1.0E+19 to int loses precision in /home/superte1/themesbyte.com/wp-includes/class-wp-hook.php on line 78

Deprecated: Implicit conversion from float 1.0E+40 to int loses precision in /home/superte1/themesbyte.com/wp-includes/class-wp-hook.php on line 76

Deprecated: Implicit conversion from float 1.0E+40 to int loses precision in /home/superte1/themesbyte.com/wp-includes/class-wp-hook.php on line 78

Deprecated: Implicit conversion from float 1.0E+40 to int loses precision in /home/superte1/themesbyte.com/wp-includes/class-wp-hook.php on line 76

Deprecated: Implicit conversion from float 1.0E+40 to int loses precision in /home/superte1/themesbyte.com/wp-includes/class-wp-hook.php on line 78

Deprecated: Implicit conversion from float 1.0E+19 to int loses precision in /home/superte1/themesbyte.com/wp-includes/class-wp-hook.php on line 76

Deprecated: Implicit conversion from float 1.0E+19 to int loses precision in /home/superte1/themesbyte.com/wp-includes/class-wp-hook.php on line 78

Deprecated: Optional parameter $day declared before required parameter $month_num is implicitly treated as a required parameter in /home/superte1/themesbyte.com/wp-content/plugins/easy-digital-downloads/includes/deprecated-functions.php on line 595

Deprecated: Optional parameter $customer_id declared before required parameter $meta_value is implicitly treated as a required parameter in /home/superte1/themesbyte.com/wp-content/plugins/easy-digital-downloads/includes/class-edd-db-customer-meta.php on line 95

Deprecated: Optional parameter $meta_key declared before required parameter $meta_value is implicitly treated as a required parameter in /home/superte1/themesbyte.com/wp-content/plugins/easy-digital-downloads/includes/class-edd-db-customer-meta.php on line 95

Deprecated: Optional parameter $customer_id declared before required parameter $meta_value is implicitly treated as a required parameter in /home/superte1/themesbyte.com/wp-content/plugins/easy-digital-downloads/includes/class-edd-db-customer-meta.php on line 123

Deprecated: Optional parameter $meta_key declared before required parameter $meta_value is implicitly treated as a required parameter in /home/superte1/themesbyte.com/wp-content/plugins/easy-digital-downloads/includes/class-edd-db-customer-meta.php on line 123

Deprecated: Optional parameter $meta_key declared before required parameter $meta_value is implicitly treated as a required parameter in /home/superte1/themesbyte.com/wp-content/plugins/easy-digital-downloads/includes/class-edd-customer.php on line 821

Deprecated: Optional parameter $meta_key declared before required parameter $meta_value is implicitly treated as a required parameter in /home/superte1/themesbyte.com/wp-content/plugins/easy-digital-downloads/includes/class-edd-customer.php on line 835

Deprecated: Optional parameter $download_id declared before required parameter $payment_id is implicitly treated as a required parameter in /home/superte1/themesbyte.com/wp-content/plugins/easy-digital-downloads/includes/payments/functions.php on line 395

Deprecated: Optional parameter $download_id declared before required parameter $user_purchase_info is implicitly treated as a required parameter in /home/superte1/themesbyte.com/wp-content/plugins/easy-digital-downloads/includes/download-functions.php on line 223

Deprecated: Optional parameter $download_id declared before required parameter $payment_id is implicitly treated as a required parameter in /home/superte1/themesbyte.com/wp-content/plugins/easy-digital-downloads/includes/download-functions.php on line 611

Deprecated: Optional parameter $download_id declared before required parameter $payment_id is implicitly treated as a required parameter in /home/superte1/themesbyte.com/wp-content/plugins/easy-digital-downloads/includes/download-functions.php on line 644

Deprecated: Optional parameter $download_id declared before required parameter $amount is implicitly treated as a required parameter in /home/superte1/themesbyte.com/wp-content/plugins/easy-digital-downloads/includes/download-functions.php on line 723

Deprecated: Optional parameter $download_id declared before required parameter $amount is implicitly treated as a required parameter in /home/superte1/themesbyte.com/wp-content/plugins/easy-digital-downloads/includes/download-functions.php on line 736

Deprecated: Optional parameter $download_id declared before required parameter $file_key is implicitly treated as a required parameter in /home/superte1/themesbyte.com/wp-content/plugins/easy-digital-downloads/includes/download-functions.php on line 988

Deprecated: Optional parameter $args declared before required parameter $endpoint is implicitly treated as a required parameter in /home/superte1/themesbyte.com/wp-content/plugins/breadcrumb-navxt/class.bcn_rest_controller.php on line 64

Deprecated: Optional parameter $override declared before required parameter $endpoint is implicitly treated as a required parameter in /home/superte1/themesbyte.com/wp-content/plugins/breadcrumb-navxt/class.bcn_rest_controller.php on line 64

Deprecated: Return type of Requests_Cookie_Jar::offsetExists($key) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/superte1/themesbyte.com/wp-includes/Requests/Cookie/Jar.php on line 63

Deprecated: Return type of Requests_Cookie_Jar::offsetGet($key) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/superte1/themesbyte.com/wp-includes/Requests/Cookie/Jar.php on line 73

Deprecated: Return type of Requests_Cookie_Jar::offsetSet($key, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/superte1/themesbyte.com/wp-includes/Requests/Cookie/Jar.php on line 89

Deprecated: Return type of Requests_Cookie_Jar::offsetUnset($key) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/superte1/themesbyte.com/wp-includes/Requests/Cookie/Jar.php on line 102

Deprecated: Return type of Requests_Cookie_Jar::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/superte1/themesbyte.com/wp-includes/Requests/Cookie/Jar.php on line 111

Deprecated: Return type of Requests_Utility_CaseInsensitiveDictionary::offsetExists($key) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/superte1/themesbyte.com/wp-includes/Requests/Utility/CaseInsensitiveDictionary.php on line 40

Deprecated: Return type of Requests_Utility_CaseInsensitiveDictionary::offsetGet($key) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/superte1/themesbyte.com/wp-includes/Requests/Utility/CaseInsensitiveDictionary.php on line 51

Deprecated: Return type of Requests_Utility_CaseInsensitiveDictionary::offsetSet($key, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/superte1/themesbyte.com/wp-includes/Requests/Utility/CaseInsensitiveDictionary.php on line 68

Deprecated: Return type of Requests_Utility_CaseInsensitiveDictionary::offsetUnset($key) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/superte1/themesbyte.com/wp-includes/Requests/Utility/CaseInsensitiveDictionary.php on line 82

Deprecated: Return type of Requests_Utility_CaseInsensitiveDictionary::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/superte1/themesbyte.com/wp-includes/Requests/Utility/CaseInsensitiveDictionary.php on line 91
WooCommerce plus and minus buttons on cart – ThemesByte

ThemesByte

WooCommerce plus and minus buttons on cart

Change the WooCommerce default quantity style to the Plus-minus button on your cart page. We need only two steps to achieve this.

1. Paste the below jQuery code on your custom js file

$(function(a){
	a(".woocommerce-ordering").on("change", "select.orderby", function(){
		a(this).closest("form").submit();
	}),
	a("div.quantity:not(.buttons_added), td.quantity:not(.buttons_added)").addClass("buttons_added").append('<span class="plus"><i class="aep-icon-plus"></span>').prepend('<span class="minus"><i class="aep-icon-minus-sign"></span>'), a("input.qty:not(.product-quantity input.qty)").each(function(){
		var b=parseFloat(a(this).attr("min"));b&&b>0&&parseFloat(a(this).val())<b&&a(this).val(b);
	}),
	a(document).on("click", ".plus, .minus", function(){
		var b=a(this).closest(".quantity").find(".qty"),
		c=parseFloat(b.val()),
		d=parseFloat(b.attr("max")),
		e=parseFloat(b.attr("min")),
		f=b.attr("step");c&&""!==c&&"NaN"!==c||(c=0),
		(""===d||"NaN"===d)&&(d=""),
		(""===e||"NaN"===e)&&(e=0),
		("any"===f||""===f||void 0===f||"NaN"===parseFloat(f))&&(f=1),
		a(this).is(".plus")?b.val(d&&(d==c||c>d)?d:c+parseFloat(f)):e&&(e==c||e>c)?b.val(e):c>0&&b.val(c-parseFloat(f)),
		b.trigger("change");
		});
});

2. Paste the below CSS code on your style.css

.quantity .qty {
    padding: 0;
    width: 20%;
    min-width: 30px;
    max-height: 24px;
    text-align: center;
    border: 0;
    color: #282828;
    outline: 0;
    -webkit-appearance: none;
    background: transparent;
    -moz-appearance: textfield;
}
.quantity.buttons_added{
    font-size: 12px;
    font-weight: 700;
}
span.plus, span.minus {
    cursor: pointer;
    border-radius:50%;
    padding:7px;
    width:40px;
    height:40px;
}
span.plus:hover, span.minus:hover{
    background:#ddd;
}
.actions .button:hover{
   color:#111 !important
}

and done! Now your cart page quantity looks like given screenshot.

Rafiul

Rafiul

Hi, I am B M Rafiul Alam full-stack WordPress developer. I love to develop WordPress themes and Plugins. I developed a couple of themes and plugins for the Wordpress.org repository.


Deprecated: rtrim(): Passing null to parameter #1 ($string) of type string is deprecated in /home/superte1/themesbyte.com/wp-includes/formatting.php on line 2761