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
Hey Community! As we jump into 2025, we want to give a big shout-out to all of you wh...
By JasonH Jan 7, 2025Hey Community! As the holiday season unfolds, we want to extend heartfelt thanks to a...
By JasonH Dec 6, 2024Dropshipping, a high-growth, $226 billion-dollar industry, remains a highly dynamic bus...
By JasonH Nov 27, 2024