-
-
Save DeoThemes/647d255d1575953890d74874d3fa3a35 to your computer and use it in GitHub Desktop.
Could you explain to me what the function of this part of the code below do?
var forms = jQuery('.woocommerce-cart-form, form.cart'); forms.find('.quantity.hidden').prev( '.quantity__button' ).hide(); forms.find('.quantity.hidden').next( '.quantity__button' ).hide();
This code is necessary in case you have a product that sold individually. You can test this option in Product -> Inventory -> Sold individually checkbox. Without this code, the quantity input will not show up and only arrows will display.
Ok, Very Nice.
Thanks for explain.
Have a Grate Week!
Hi again.
On the SLACK forum where I looked for help on the solution you developed, I received some instructions from a user who can guarantee that the code is compatible with more plugins. Here's what she wrote:
*** As someone who fields support tickets from people who use my plugin with custom plus/minus buttons... please be sure to:
01 - link the plus/minus buttons to the closest quantity input (sometimes there's more than 1)
02 - correctly handle an empty input... assume empty = 0
03 - chain a .change() event on the input after you change the value of the input.**
She's even here on GitHub as: https://github.com/helgatheviking
He is a very helpful person!
Hello @DeoThemes
After implementing this solution,
https://docs.woocommerce.com/document/override-loop-template-and-show-quantities-next-to-add-to-cart-buttons/
To show the Quantity fields and your code to show the buttons.
I found that it doesn't work with Ajax.
So I found another one that works. However, it came with a small problem.
I use the ContentViews Plugin to display my products, and the quantity field is not showing up in ContentViews with the new code.
Plugin developers told me that:
Our plugin uses the "add_to_cart" shortcode of WooCommerce to show the "Add to cart" button.
Look to the code:
https://gist.github.com/webaware/6260468
Looking at the code, is it possible to know how to change it so that it is also displayed in the contentviews listing?
Solved,
This plugin show quantity buttons on all places and work with ajax.
https://br.wordpress.org/plugins/quantity-field-on-shop-page-for-woocommerce/
Thanks.
This code is necessary in case you have a product that sold individually. You can test this option in Product -> Inventory -> Sold individually checkbox. Without this code, the quantity input will not show up and only arrows will display.