I checked the website once more. While in my previous post I mentioned that scripts and CSS are correctly loaded on the shop page, I meant home page. Qty Increment Buttons for WooCommerce as it stands in plugin features supports product, cart, shop and category pages. The only reason why the buttons and quantity field show up on your home page that is not a shop page is because of custom changes.
The code to change quantity is inline script and is significantly different from the original code. What does not work for you, is the quantity in the input field not being added to cart. That’s because the inline script that is normally added to shop and category pages, is not loaded on your home page at all. Even if you enqueued this script for your home page, keep in mind that there is no .archive
class on your home page, so you would need a different selector to target the element on your home page. For now, I don’t plan to add Home page support.
jQuery( ".woocommerce.archive" ).on( "click", ".quantity input", function() {
return false;
});
jQuery( ".woocommerce.archive" ).on( "change input", ".quantity .qty", function() {
var add_to_cart_button = jQuery( this ).parents( ".product" ).find( ".add_to_cart_button" );
// For AJAX add-to-cart actions
add_to_cart_button.data( "quantity", jQuery( this ).val() );
// For non-AJAX add-to-cart actions
add_to_cart_button.attr( "href", "?add-to-cart=" + add_to_cart_button.attr( "data-product_id" ) + "&quantity=" + jQuery( this ).val() );
});
Maybe changing to jQuery( ".woocommerce" )
and enqueuing on home page would be enough?
In the next release of Qty Increment Buttons for WooCommerce, I’ll address 4 styling issues that my plugin has on your page (you would need to eliminate !important from min-width and max-width to make quantity input field affected by 2 of these changes.). I’ll try to release the next version this Monday.
-
This reply was modified 5 years, 4 months ago by taisho.
-
This reply was modified 5 years, 4 months ago by taisho.