- This topic has 3 replies, 2 voices, and was last updated 3 years ago by
David.
-
AuthorPosts
-
March 9, 2023 at 6:14 am #2561448
Damien
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.
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'; }March 9, 2023 at 6:29 am #2561466David
StaffCustomer SupportHi there,
thanks for reporting this, we are aware of the issue and there is a PR open to fix it.
The issue arose through changes made in woo 7.4, for it was related to this:https://github.com/woocommerce/woocommerce/issues/36855#issuecomment-1434609352
But there are other related issues we’re waiting for Woo to resolve as this will determine if/what we need to patch.
A similar topic arose here, which may be of interest as the base for a temporary fix:
https://generatepress.com/forums/topic/woocommerce-7-4-product-page-quantity-buttons/#post-2547284
March 9, 2023 at 7:21 am #2561533Damien
Thanks for the update.
Coincidentally I’ve just written code very similar to that which you suggested (I only checked for is_sold_individually).March 9, 2023 at 7:54 am #2561707David
StaffCustomer SupportGlad to hear that. And thanks again for reporting !
-
AuthorPosts
- You must be logged in to reply to this topic.