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

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

lsvvintage
Excursionist
31 2 3

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

Replies 7 (7)

suyash1
Shopify Partner
10434 1287 1646

@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 

Support me | To build shopify pages use PAGEFLY | Contact me - suyash.patankar@gmail.com , My timezone is GMT+5:30.

Asad-Mahmood
Navigator
299 51 55

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 %}

 

If my solution has been helpful, you can consider supporting me via Buy Me a Coffee.
Hire me: asadmahmood8470@gmail.com
WhatsApp





oscprofessional
Shopify Partner
16205 2422 3146

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 

oscprofessional_0-1736169819597.png

 

Get pass your Store Core Web Vital Free Speed Optimization Audit, Chat on WhatsApp | Skype : oscprofessionals-87 | Email: pallavi@oscprofessionals.com | Hire us | Guaranteed Site Speed Optimization | Website Free Audit | Shopify Theme Customization | Build Shopify Private App | Shopify SEO | Digital Marketing | Oscp Upsell & Cross sell App : Free | Oscp Sales & Volume Discount App : Free | Custom Pricing Wholesale App : Free | OSCP Shipping Discounts App : Free
lsvvintage
Excursionist
31 2 3

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>

Scherm­afbeelding 2025-01-06 om 15.49.46.png

lsvvintage
Excursionist
31 2 3

Hi!

 

Do you have any update on this matter? ☻


Best,

Laura

DaisyVo
Shopify Partner
2354 291 333

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

 

image.png

 

I hope this helps

 

Best,

 

Daisy

Please let us know if our reply is helpful by giving it a Like or marking it as a Solution!

Avada SEO & Image Optimizer - The #1 SEO solution
lsvvintage
Excursionist
31 2 3

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