- This topic has 14 replies, 3 voices, and was last updated 2 years, 5 months ago by
Natalie.
-
AuthorPosts
-
February 25, 2023 at 6:53 am #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
SamFebruary 25, 2023 at 7:19 am #2546525Sam
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; }
February 26, 2023 at 5:17 am #2547284David
StaffCustomer SupportHi 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; }
February 26, 2023 at 8:36 am #2547554Sam
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
February 26, 2023 at 9:57 am #2547640David
StaffCustomer SupportCan you clear any of the Woocommerce caches in Woocommerce > Status > Tools, and then clear any plugin / server caches ?
February 27, 2023 at 1:34 am #2548228Sam
The only option is “Clear template cache” I do not know what that does but I assume this is what you mean?
February 27, 2023 at 6:34 am #2548546David
StaffCustomer SupportNever 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; }
February 27, 2023 at 7:02 am #2548570Sam
OK thanks, that worked.
Will the issue be patched in an update?
thanks
February 27, 2023 at 7:10 am #2548581David
StaffCustomer SupportYep, 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 🙂
March 15, 2023 at 5:23 am #2568410Natalie
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?
ThanksMarch 15, 2023 at 6:42 am #2568503David
StaffCustomer SupportHi 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.
April 1, 2023 at 5:41 am #2591897Natalie
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
GP correctly hides the quantity but it still shows the +/- buttons on the single product and cart pages see:
If I disable the GP Premium ‘Woocommerce’ module then the cart page displays correctly – i.e. no +/- buttons. See:
Hopefully you have a fix in the pipeline for this as well?
April 1, 2023 at 5:45 am #2591898Natalie
Just adding my links again as they don’t seem to be clickable in my post above
https://u.pcloud.link/publink/show?code=XZp7zwVZ5mEIXEHUW9uXlC9W2M6FLyQIXkOX
https://u.pcloud.link/publink/show?code=XZ17zwVZRLNxk8NQrz8fuOQRJRM91FtSvtCy
https://u.pcloud.link/publink/show?code=XZN7zwVZsgRpa3QPwoppeK7cETd24XkxXUmVApril 1, 2023 at 7:02 am #2591978David
StaffCustomer SupportAre 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.
April 1, 2023 at 10:52 pm #2592649Natalie
Thanks
I have opened a new topic for this
-
AuthorPosts
- You must be logged in to reply to this topic.