How to add SOLD OUT badge on Envy theme

Giocagio
New Member
5 0 0

Hello,

I have a problem with my Envy theme, i need to add a SOLD OUT badge on it, i try with the code but it isn't working.
 Website is: https://giocagio.com

This is the code:

if liquidObject.available %}
    {% if liquidObject.compare_at_price_max > liquidObject.price and settings.sale_badge %}
      <div class="envy-badge sale-badge">{{ 'products.general.sale' | t }}</div>
    {% endif %}
  {% elsif settings.sold_out_badge %}
    <div class="envy-badge sold-out-badge">{{ 'products.product.sold_out' | t }}</div>
  {% endif %}
</div>

 
Can someone help me?

Thank you

0 Likes
Olivia
Shopify Staff
Shopify Staff
579 58 113

Hey, @Giocagio.

Welcome to Shopify Community. My name is Olivia and I work here.

Thank you for sharing your question with our network. While our Support team does not provide advice on third-party theme code, I was happy to do some research for you that may provide some insight.

Check out this related thread on changing prices to sold out when items are out of stock. There's an additional snippet of code described in the thread to address conditional product availability and badge behaviour that you may be able to adjust to your theme.

I trust this will provide further insight, but I also encourage other community members and developers to share their feedback.

Warm regards,

Olivia | Social Care @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

0 Likes