Change sold out button for a specific collection (STUDIO THEME)

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 :slight_smile:

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' %}
  
{% else %}
  
{% 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!

{%- if card_product.selected_or_first_available_variant.available -%} {{ 'products.product.add_to_cart' | t }} {%- else -%} {{ 'products.product.sold_out' | t }} {%- endif -%} {{ 'products.product.sold_out' | t }} {% if product.tags contains 'archive' or collection.handle == 'archive' %} Archive {% else %} Sold Out {% endif %}

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

Hi!

Do you have any update on this matter? :slight_smile:

Best,

Laura