Shopify themes, liquid, logos, and UX
Hi all!
I'm on the Studio theme right now and I'm looking for a solution to change the "sold out" button to "archive" for a specific collection OR just for products with the tag "archive" either one is fine. Can somebody tell me where to change that and which code to add? it would be greatly appreciated!! thanks already ☻
Kind regards,
Laura
@lsvvintage you will need to edit product.liquid or product-template.liquid file to find out the code for this sold out button, and then you will need to edit the code to check if the tag is present in the product, if it is present then change the text to archive else sold out
you will need to enclose button text inside a condition
{% if product.collections contains 'specific-collection-handle' and product.available == false %}
Archive
{% else %}
Sold Out
{% endif %}
Hi @lsvvintage ,
Add Logic to Change the Button Text
{% if product.tags contains 'archive' or collection.handle == 'your-collection-handle' %}
<button class="btn archive">Archive</button>
{% else %}
<button class="btn sold-out">Sold Out</button>
{% endif %}
For sold out button code you can find out in the card-product.liquid file
Hi!
Thanks for your reply!
Would the following be correct? Because I don't see the changes on the website yet so I think I did something wrong. Probably need to delete a piece of the code? Please let me know!
<span>
{%- if card_product.selected_or_first_available_variant.available -%}
{{ 'products.product.add_to_cart' | t }}
{%- else -%}
{{ 'products.product.sold_out' | t }}
{%- endif -%}
</span>
<span class="sold-out-message hidden">
{{ 'products.product.sold_out' | t }}
{% if product.tags contains 'archive' or collection.handle == 'archive' %}
<button class="btn archive">Archive</button>
{% else %}
<button class="btn sold-out">Sold Out</button>
{% endif %}
</span>
Hi!
Do you have any update on this matter? ☻
Best,
Laura
Hi @lsvvintage
Please change Go to Shopify Admin -> Online Store ->Theme -> Edit code > Search file en.default.json and change Sold out to Archived here
I hope this helps
Best,
Daisy
Hi Daisy,
Thanks for your reply! But I'm not sure if this works with the 'rules' I'd like it to apply to? I do not want to change all 'sold out' to 'archive', only for products in the 'archive' collection or tagged with 'archive' should get this change. Hope you can help me. Thanks!
Best,
Laura
Find Global Growth Opportunities For Your Business with Shopify AcademyLearn how to exp...
By Shopify Feb 4, 2025Hey Community, happy February! Looking back to January, we kicked off the year with 8....
By JasonH Feb 3, 2025Expand into selling wholesale with Shopify Academy’s learning path, B2B on Shopify: Lau...
By Shopify Jan 28, 2025