Shopify themes, liquid, logos, and UX
Hi!
I've been struggling with finding a solution for this for a while now, so hopefully you can help me!
I want to add an if-rule to the sold out button, that when a product has the tag 'archive', the 'sold out' button changes to 'ARCHIVE'. Preferably on the collection page only, if that's not possible, then on both collection as well as the product page.
If somebody could please share how to create this, that would be amazing!!!
Thanks a lot,
- L
Solved! Go to the solution
This is an accepted solution.
Follow the below instructions:
1) In your theme's code in the snippets folder open the file 'card-product.liquid'
2) In the above file search for this piece of code that is located at around line 130 and it's below a <span> element with id that starts with
'NoMediaStandardBadge'
{{- 'products.product.sold_out' | t -}}
3) Replace the above code with this one:
{% assign archive_found = false %}
{% for tag in card_product.tags %}
{% if archive_found == false and tag contains 'ARCHIVE'%}
ARCHIVE
{% assign archive_found = true %}
{% endif %}
{% endfor %}
{% if archive_found == false %}
{{- 'products.product.sold_out' | t -}}
{% endif %}
Could you please share your store's URL ?
Hi, yes sure: https://laurastappersvintage.com/en/collections/archive
It's for this page
So you want to change the card badge from Sold out to ARCHIVE if that product has a tag of ARCHIVE?
Yes, correct!
This is an accepted solution.
Follow the below instructions:
1) In your theme's code in the snippets folder open the file 'card-product.liquid'
2) In the above file search for this piece of code that is located at around line 130 and it's below a <span> element with id that starts with
'NoMediaStandardBadge'
{{- 'products.product.sold_out' | t -}}
3) Replace the above code with this one:
{% assign archive_found = false %}
{% for tag in card_product.tags %}
{% if archive_found == false and tag contains 'ARCHIVE'%}
ARCHIVE
{% assign archive_found = true %}
{% endif %}
{% endfor %}
{% if archive_found == false %}
{{- 'products.product.sold_out' | t -}}
{% endif %}
Hi!
Thanks for your reply! I've tried, but do not see a difference yet. Here is a screenshot of my code:
Did I do something wrong?
Make sure that you indeed have 'ARCHIVE' as a tag in those products all uppercase
ah, that was the problem! now it works!! thank you very very much, you're a lifesaver!
2m ago Learn the essential skills to navigate the Shopify admin with confidence. T...
By Shopify Feb 12, 2025Learn how to expand your operations internationally with Shopify Academy’s learning path...
By Shopify Feb 4, 2025Hey Community, happy February! Looking back to January, we kicked off the year with 8....
By JasonH Feb 3, 2025