With GeneratePress 3.2.4 and GP Premium 2.2.2 and WooCommerce module enabled and ‘Display quantity buttons’ enabled, the quantity buttons show when the product is sold individually.
https://imgur.com/pXI9R2J
I think that the code should add a $product->is_sold_individually() check.
I know that I can disable ‘Display quantity buttons’ but I would like to leave that enabled for regular products.
Here’s my suggested patch for gp-premium/woocommerce/functions.php:
--- woocommerce/functions/functions.orig.php 2021-10-26 19:49:48.000000000 +0100
+++ woocommerce/functions/functions.php 2023-03-09 13:05:08.690854300 +0000
@@ -155,7 +155,12 @@
}
}
- if ( 'product' === get_post_type() || is_cart() ) {
+ $sold_individually = false;
+ if ( 'product' === get_post_type() ) {
+ $product = wc_get_product( get_the_ID() );
+ $sold_individually = $product->is_sold_individually();
+ }
+ if ( ( 'product' === get_post_type() && !$sold_individually ) || is_cart() ) {
if ( generatepress_wc_get_setting( 'quantity_buttons' ) ) {
$classes[] = 'do-quantity-buttons';
}