Site logo

[Support request] Woocommerce 7.4 – product page quantity buttons

Home Forums Support [Support request] Woocommerce 7.4 – product page quantity buttons

Home Forums Support Woocommerce 7.4 – product page quantity buttons

Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
    Posts
  • #2546501
    Sam

    Hello, since updating to woocommerce 7.4 I have noticed that on the product page, when a simple product only has one unit in stock, there are some empty quantity buttons displayed: https://snipboard.io/isflJo.jpg

    These used to be hidden if quantity is 1. Is this something that needs updating in GP?

    Kind regards
    Sam

    #2546525
    Sam

    Note: I managed to hide them with the following CSS but this is not ideal as it causes the quantity buttons to be hidden briefly on simple product pages with inventory greater than 1. This obviously counts negatively as cumulative layout shift and so is bad for SEO so I need a better way of fixing the issue.

    .woocommerce .product .quantity:not(.buttons-added) {
    	display: none;
    }
    #2547284
    David
    Staff
    Customer Support

    Hi there,

    thanks for reporting this, not sure if its a bug or if the your Woo database needs updating. Make sure it is updated, and then clear any of the Woo caches.

    If the issues persists, let us know, and you can use this snippet as temporary fix:

    add_filter( 'post_class', 'remove_post_class_if_single_product_low_stock', 10, 3 );
    function remove_post_class_if_single_product_low_stock( $classes, $class, $post_id ) {
        if ( is_product() ) {
            $product = wc_get_product( $post_id );
            if ( $product && $product->is_type( 'simple' ) && $product->managing_stock() && $product->get_stock_quantity() <= 1 ) {
                $classes = array_diff( $classes, array( 'do-quantity-buttons' ) );
            }
        }
    
        return $classes;
    }
    #2547554
    Sam

    My DB version matches the Woocommerce version so I do not think it needs updating.

    Thanks for your snippet, although it only partially works, it still leaves some styling from the +/- buttons so it is slightly out of alignment: https://snipboard.io/k7VhJM.jpg

    #2547640
    David
    Staff
    Customer Support

    Can you clear any of the Woocommerce caches in Woocommerce > Status > Tools, and then clear any plugin / server caches ?

    #2548228
    Sam

    The only option is “Clear template cache” I do not know what that does but I assume this is what you mean?

    #2548546
    David
    Staff
    Customer Support

    Never mind, clearing caches or transients won’t make a difference, i have been able to replicate the issue locally.
    Add this CSS to remove that space when there are no quantity buttons displayed:

    .single-product article:not(.do-quantity-buttons) form.cart div.quantity {
        margin-right: 0 !important;
    }
    #2548570
    Sam

    OK thanks, that worked.

    Will the issue be patched in an update?

    thanks

    #2548581
    David
    Staff
    Customer Support

    Yep, thanks for reporting it, i have it on our GitIssues and we should be able to push an update out once we figure out Woo changed to cause the issue 🙂

    #2568410
    Natalie

    I have the same issue. I have used CSS to hide the +/- buttons on the single product page, but they still show on the cart page. Will your fix remove them from the cart page as well for products sold individually?

    Any idea of an ETA for the fix?
    Thanks

    #2568503
    David
    Staff
    Customer Support

    Hi there,

    if that issue is related then yes it should fix the cart page.
    However these issues stem from Woocommerce changes to which there are several issues they have open, so we expect to see them make some changes.

    The GP Changes as raised here, have been patched on GP Premium 2.3 – see here:

    https://generatepress.com/category/changelog/

    If you want to test then the alpha release is available in the your account.

    Any testing and feedback would be much appreciated.

    #2591897
    Natalie

    OK. I have realised that my situation is slightly different. My product is set up to be ‘sold individually’. So the ‘in stock ‘ quantity is greater than 1 but the customer is only allowed to purchase 1 of the product
    product setting

    GP correctly hides the quantity but it still shows the +/- buttons on the single product and cart pages see:

    https://u.pcloud.link/publink/show?code=XZ17zwVZRLNxk8NQrz8fuOQRJRM91FtSvtCy

    If I disable the GP Premium ‘Woocommerce’ module then the cart page displays correctly – i.e. no +/- buttons. See:
    https://u.pcloud.link/publink/show?code=XZN7zwVZsgRpa3QPwoppeK7cETd24XkxXUmV

    Hopefully you have a fix in the pipeline for this as well?

    #2591898
    Natalie
    #2591978
    David
    Staff
    Customer Support

    Are you running the latest version of GP Premium ? Now 2.3.1

    If so can i see the site where the problems are. If needed raise a new topic where you will have access to the Private Information field.

    #2592649
    Natalie
Viewing 15 posts - 1 through 15 (of 15 total)
  • You must be logged in to reply to this topic.