We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more

Re: hide the 'sold out' text on certain products on shopify store

hide the 'sold out' text on certain products on shopify store

Shopquestion234
New Member
10 0 0

I have some products that are sold out and some that are coming soon. I have changed the 'sold out' text in the language settings but want to just hide this text completely for products which are actually sold out.

 

I don't want to hide by product.type as these are filled in specifically for shipping. Can it be done by a collection or tags?

 

I use Dawn theme

Replies 10 (10)

Dan-From-Ryviu
Shopify Partner
12073 2359 2539

Hi @Shopquestion234 

Could you the link to your store so I can check?

- Helpful? Like & Accept solution!
- Ryviu - Product Reviews & QA app: Collect customer reviews, import reviews from AliExpress, Amazon, Etsy, Walmart, Dhgate and CSV.
- Lookfy Gallery: Lookbook Image - Gain customers with photo gallery, video & shoppable image.
- Reelfy‑Shoppable Videos+Reels: Create shoppable videos to engage customers and drive more sales.
- Enjoy 1 month of Shopify for $1. Sign up now.

Dan-From-Ryviu
Shopify Partner
12073 2359 2539

Or you can try to add this code to your theme.liquid file, after <head> in Online Store > Themes > Edit code to check

<style>
.card:has(.price--sold-out) .card__badge { display: none !important; }
</style>

- Helpful? Like & Accept solution!
- Ryviu - Product Reviews & QA app: Collect customer reviews, import reviews from AliExpress, Amazon, Etsy, Walmart, Dhgate and CSV.
- Lookfy Gallery: Lookbook Image - Gain customers with photo gallery, video & shoppable image.
- Reelfy‑Shoppable Videos+Reels: Create shoppable videos to engage customers and drive more sales.
- Enjoy 1 month of Shopify for $1. Sign up now.

Shopquestion234
New Member
10 0 0

I cant see  theme.liquid as a file

Screenshot 2024-08-09 102215.png

 

Dan-From-Ryviu
Shopify Partner
12073 2359 2539

It should be there under Layout folder, try to search theme only

 

- Helpful? Like & Accept solution!
- Ryviu - Product Reviews & QA app: Collect customer reviews, import reviews from AliExpress, Amazon, Etsy, Walmart, Dhgate and CSV.
- Lookfy Gallery: Lookbook Image - Gain customers with photo gallery, video & shoppable image.
- Reelfy‑Shoppable Videos+Reels: Create shoppable videos to engage customers and drive more sales.
- Enjoy 1 month of Shopify for $1. Sign up now.

Shopquestion234
New Member
10 0 0

FOund this. And it does hide the 'sold out' box (that id changed for 'coming soon'. But i would like to only hide this on certain products. Can't be based on the product type as this is already populated for other reasons so can we hide the 'coming soon' for anything with a 'sold out' tag

 

Dan-From-Ryviu
Shopify Partner
12073 2359 2539

It will hide the badge of sold-out products only. 

- Helpful? Like & Accept solution!
- Ryviu - Product Reviews & QA app: Collect customer reviews, import reviews from AliExpress, Amazon, Etsy, Walmart, Dhgate and CSV.
- Lookfy Gallery: Lookbook Image - Gain customers with photo gallery, video & shoppable image.
- Reelfy‑Shoppable Videos+Reels: Create shoppable videos to engage customers and drive more sales.
- Enjoy 1 month of Shopify for $1. Sign up now.

Shopquestion234
New Member
10 0 0

So i have some products that are 'coming soon' that i want the badge to show for but i want to hide for actual sold out products. As both have 0 stock they just all show as coming soon even if some have been sold for a while but are now sold out. I want to hide the coming soon message for products that i choose and keep for the ones that are coming soon.

 

can i add code to hide the 'sold out/coming soon' message for products that i have assigned a certain tag to?

 

Shopquestion234
New Member
10 0 0

It is a personal store for a client therefore password protected. 

magecomp
Shopify Partner
469 31 48

Hello @Shopquestion234 

 

You'll need to modify your Dawn theme's code. 

  1. Create a duplicate of your theme to avoid affecting the live theme.
  2. Go to Online Store > Themes > Actions > Edit code.
  3. Find the product-template.liquid file in the Sections folder.
  4. Find the code block that iterates through product variants. It typically looks like this:
Code snippet
{% for variant in product.variants %}
  {% if variant.available %}
    {% else %}
    {% endif %}
{% endfor %}
5. Implement Conditional Logic:
  • Use Liquid conditions to check if the product belongs to a specific collection or has a particular tag.
  • If the condition is met and the product is sold out, hide the "sold out" text.
{% for variant in product.variants %}
  {% if variant.available %}
    {% else %}
    {% if product.tags contains 'coming_soon' or product.collections contains 'preorder_collection' %}
      {% else %}
      <span class="sold-out">Sold Out</span>
    {% endif %}
  {% endif %}
{% endfor %}
6. Replace 'coming_soon' and 'preorder_collection' with your desired tags or collection handles. You might need to adjust CSS styles to ensure the product display looks correct when the "sold out" text is hidden.
Helping voluntarily. Please like and accept the solution if it helps. Thanks!
Our Bestseller Shopify Apps    |      Mobile App Builder by MageComp    |      Shoplock Hide Pages/Collections

Need a developer?  Just visit MageComp website
Shopquestion234
New Member
10 0 0

Screenshot 2024-08-09 102320.png

I don't have the product-template.liquid in my theme?