ajax - In WooCommerce product archive, how can you also set the quantity to be added to cart by typing, instead of just by using

admin2025-01-07  6

As it stands right now, in WooCommerce 3.5.1, at product archive (the /shop page), if you use the +/- buttons to set a quantity before clicking "Add to cart", all is fine. But if you try to actually type it in the input#quantity field instead of using the buttons, it adds just one product to cart.

This plugin seems to not have the issue, for single products: /

This guy has done something similar for the cart page: /

Using the theme Porto:

Please test using this website: /product-category/managed-services/

Any idea how to solve it for the product archive as well?

As it stands right now, in WooCommerce 3.5.1, at product archive (the /shop page), if you use the +/- buttons to set a quantity before clicking "Add to cart", all is fine. But if you try to actually type it in the input#quantity field instead of using the buttons, it adds just one product to cart.

This plugin seems to not have the issue, for single products: https://wordpress.org/plugins/woocommerce-ajax-cart/

This guy has done something similar for the cart page: https://businessbloomer.com/woocommerce-automatically-update-cart-quantity-change/

Using the theme Porto: https://themeforest.net/item/porto-responsive-wordpress-ecommerce-theme/9207399

Please test using this website: https://upvotes.club/product-category/managed-services/

Any idea how to solve it for the product archive as well?

Share Improve this question edited Nov 16, 2018 at 10:35 Robert Calceanu asked Nov 16, 2018 at 8:22 Robert CalceanuRobert Calceanu 113 bronze badges 4
  • As far as I'm aware, WooCommerce doesn't support selecting a product quantity on archive pages. Are you using a theme or plugin to do this? – Jacob Peattie Commented Nov 16, 2018 at 8:34
  • Using a theme. I updated the question! – Robert Calceanu Commented Nov 16, 2018 at 10:35
  • If using this plugin instead of the theme functionality, and in the same time except jquery from minification and grouping, it works: Quantity Field on Shop Page for WooCommerce wordpress.org/plugins/… It seems that jQuery has to be excepted from minification and grouping because otherwise the code starting with this gives an error: <script type="text/javascript">jQuery('.products .post-10 a').click(function(){if(true===jQuery(this).hasClass('add_to_cart_button')){return;} – Robert Calceanu Commented Nov 20, 2018 at 14:05
  • wordpress.org/plugins/… I think this plugin help you... – JIGNESHKUMAR Commented Oct 19, 2022 at 9:28
Add a comment  | 

1 Answer 1

Reset to default 0

If using this plugin instead of the theme functionality, and in the same time except jquery from minification and grouping, it works:

Quantity Field on Shop Page for WooCommerce https://wordpress.org/plugins/quantity-field-on-shop-page-for-woocommerce/

It seems that jQuery has to be excepted from minification and grouping because otherwise the code starting with this gives an error:

<script type="text/javascript">jQuery('.products .post-10 a').click(function(){if(true===jQuery(this).hasClass('add_to_cart_button')){return;}

Anyway, they said they'll be fixing the theme in the version, so buying Reddit upvotes and other marketing services will be possible through https://upvotes.club without any additional WordPress plugin on the backend.

Hopefully the solution that I gave ends up saving someone else in a similar situation.

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1736264743a991.html

最新回复(0)