nielslange / smntcs-quantity-buttons-for-woocommerce

Display quantity buttons on WooCommerce product page.
https://wordpress.org/plugins/smntcs-woocommerce-quantity-buttons/
GNU General Public License v2.0
8 stars 4 forks source link

Add compatibility for grouped products #21

Closed nielslange closed 4 years ago

nielslange commented 4 years ago

Reported in https://wordpress.org/support/topic/input-value-incorrect/#post-12604475:

If min value is 0 like with grouped products no value is shown at all and buttons don’t work untill u manually insert a value.

I solved it by changing inside quantity-input.php;

value="<?php echo esc_attr( $input_value ); ?>"

to

value="<?php echo esc_attr( $min_value ); ?>"

After this change simple and grouped products both work as expected.

Using latest woocommerce and plugin..

Please change it in future update

Jeroenleender commented 4 years ago

after updatting to 1.15 the problem is back....

nielslange commented 4 years ago

after updatting to 1.15 the problem is back....

Damn it! 🤦‍♂ Sorry for that, @Jeroenleender. I wasn't able to reproduce this issue in the first place and thought that with 1.14 it would be fixed, which apparently it was. However, 1.14 seem to break functionality for non-grouped products. That's why I deployed 1.1.5.

The issue that you are facing is that when using grouped products, no quantity is visible at all, right?

Jeroenleender commented 4 years ago

When u open a grouped product and get an overview of simple products, the default value should be 0. Your current option can't handle zero values so it won't show any number. + and - buttons don't work then untill u add a number yourself as a value.

Jeroenleender commented 4 years ago

When i use my fix all my grouped and simple products work correctly. I can't test variable products tho.

nielslange commented 4 years ago

That's good to know. Thus, I need to figure out how to detect whether a product is a grouped product. If so, handle the logic of 1.14, otherwise handle the logic of 1.1.3 resp. 1.1.5. Shouldn't be too complicated to implement. Sorry for the inconvenience caused by the latest release, though. For the time being, you could use WP Rollback to rollback my plugin to the previous version until I release 1.16.

Jeroenleender commented 4 years ago

if( $product->is_type( 'simple' ) ) since they are simple products would work, but this also effects normal simple products. So i think what would be better is to check the array and see if something matches like child parent connection that doesnt include normal simple products.

For myself i just used he former fix on the latest patch since that also works

Jeroenleender commented 4 years ago

or maybe something like this.....

if( $product->is_type( 'simple' ) && $input_value == '' )