Have your say in Community Polls: What was/is your greatest motivation to start your own business?

Re: how to remove 'sold out' button as I added dietary variant as question.its not a product.

how to remove 'sold out' button as I added dietary variant as question.its not a product.

saabbb1212
Explorer
58 3 14

Screen Shot 2024-10-14 at 3.52.08 PM.png

Replies 6 (6)

BSSCommerce-B2B
Shopify Partner
1969 564 566

Hi @saabbb1212 , 

To remove the "Sold Out" button for a variant that isn't a real product (such as a dietary question), you can customize your theme's code to hide the "Sold Out" button when the variant meets certain conditions, such as checking if it matches the dietary question.

Here's how you can do this in the Debut theme:

  1. Open the Shopify Theme Editor:
    • From your Shopify admin, go to Online Store > Themes.
    • Next to Debut, click Actions > Edit code.
  2. Locate the product-template.liquid File:
    • In the Sections folder, look for the product-template.liquid file (it might also be called main-product.liquid or something similar depending on your theme version).
  3. Edit the 'Sold Out' Button Logic:
    • Search for the code that controls the display of the "Sold Out" button. It will likely look like this:

 

{% if current_variant.available == false %}
   <button class="btn btn--sold-out" disabled>Sold Out</button>
{% endif %}
​

4. Add a Condition for Your Dietary Variant:

 

    • Modify the if condition to exclude the dietary question variant. You can identify the dietary variant by its title or option name. Here's an example:
    • Replace 'Dietary Question' with the exact title of your dietary variant.

 

{% if current_variant.available == false and current_variant.title != 'Dietary Question' %}
   <button class="btn btn--sold-out" disabled>Sold Out</button>
{% endif %}
​

5. Save the Changes:

 

    • Click Save after making the modifications.

This change will hide the "Sold Out" button only for the dietary variant, while keeping it visible for actual sold-out products. 

I hope these instructions will help you. If they are helpful, please give us likes and mark as the solution.

Have a nice day sir! 

B2B Wholesale Solution: Streamline your B2B operation with advanced features like wholesale registration forms, custom pricing.


B2B Portal, Quote, Net 30: Speed up purchasing and streamline your quotation process with advanced features like quick order, request for quote.


B2B Lock Password Protect: Easily control access to pages, products, and pricing with robust features.


BSS Commerce - Full-service eCommerce Agency I Use Shopify for 1$ in the first month now

KetanKumar
Shopify Partner
37409 3661 12115

@saabbb1212 if possible to  share your store url so i will check and update you

If helpful then please Like and Accept Solution. Partnership of your ️ Coffee Tips and my code can bring miracles.
Want to modify or custom changes on store Hire Me.
- Feel free to contact me on bamaniyaketan.sky@gmail.com regarding any help Shopify Partner | Skype : bamaniya.sky
PSD to Shopify | Shopify Design Changes | Shopify Custom Theme Development and Desing | Custom Modifications In to Shopify Theme | SEO & Digital Marketing
saabbb1212
Explorer
58 3 14

284042-80.myshopify.com.  is it that or wellnessdogco.nz 

KetanKumar
Shopify Partner
37409 3661 12115

@saabbb1212 thanks but i can't see any sold out product 

If helpful then please Like and Accept Solution. Partnership of your ️ Coffee Tips and my code can bring miracles.
Want to modify or custom changes on store Hire Me.
- Feel free to contact me on bamaniyaketan.sky@gmail.com regarding any help Shopify Partner | Skype : bamaniya.sky
PSD to Shopify | Shopify Design Changes | Shopify Custom Theme Development and Desing | Custom Modifications In to Shopify Theme | SEO & Digital Marketing
saabbb1212
Explorer
58 3 14

Thankyou but I solved it 🙂

KetanKumar
Shopify Partner
37409 3661 12115

@saabbb1212 oh wow that would be great 

If helpful then please Like and Accept Solution. Partnership of your ️ Coffee Tips and my code can bring miracles.
Want to modify or custom changes on store Hire Me.
- Feel free to contact me on bamaniyaketan.sky@gmail.com regarding any help Shopify Partner | Skype : bamaniya.sky
PSD to Shopify | Shopify Design Changes | Shopify Custom Theme Development and Desing | Custom Modifications In to Shopify Theme | SEO & Digital Marketing