Hello There ,
Is there any way to remove or hide the quantity and buy buttons only in the sold-out products and bring the notify button a bit up.
Thank you!!
Goal: hide the quantity and buy buttons on soldâout products and raise the notify button.
Initial approach: add a CSS rule in base.css using the :has() selector to hide .product-form__buttons when .priceâsold-out is present. The OP reported it âNot working,â and the helper asked where the code was added and if it was saved.
Diagnostics: another participant requested the store URL, and the OP provided a Shopify preview product link for testing.
Alternative solution proposed: edit base.css to create hidden classes (visibility: hidden; position: absolute) and modify theme.liquid to (1) include jQuery via CDN and (2) run a script on product pages that checks if the soldâout badge is visible, then adds the hidden classes to .product-form__quantity and .shopify-payment-button. Instructions included saving changes and checking the storefront results.
Latest update: another helper asked to add additional code before in theme.liquid, but the snippet was not included.
Status: no confirmed fix yet; moving the notify button âupâ wasnât addressed directly. Code snippets are central to the discussion; resolution remains open.
Hello There ,
Is there any way to remove or hide the quantity and buy buttons only in the sold-out products and bring the notify button a bit up.
Thank you!!
Hi @Anonymous
You can try to add this code at the bottom of your base.css file in Online store > Themes >Edit code to hide quantity and buy buttons
.product__info-container:has(.price--sold-out) .product-form__buttons { display: none !important; }
Not working
Hi @Anonymous
Where did you add the code? Did you save file after adding code?
@Anonymous Can you please send me your store URL?
Hi @DelightCart ,
You need to edit the code on the theme. You can follow the steps below:
Go to Shopify admin â Online store â Edit code.
Find the base.css file and add the following code at the end of the file, then save the file:
.hidden_quantiy_sold_out,
.hidden_btn_payment_sold_out {
visibility: hidden !important;
position: absolute !important;
}
+) Find the last tag in the file and add the following code before the tag
if(window.location.pathname.includes(â/productsâ)) {
if( $(â.price__badge-sold-outâ).css(âdisplayâ) !== ânoneâ) {
$(â.product-form__quantityâ).addClass(âhidden_quantiy_sold_outâ);
$(â.shopify-payment-buttonâ).addClass(âhidden_btn_payment_sold_outâ);
}
}
+) Save the file
Hope it helps @DelightCart !
Please try to add this code to your Online store > Themes > Edit code > open theme.liquid file, add code below before tag