Replace Sold Out Button with a Message for selected products

Highlighted
New Member
2 0 0

Hi, 

We have Collection of products where not all variants are in stock.

When setting particular variant to 0 Inventory, it shows the SOLD OUT button.

Instead, we need to show a custom message with a link for variants with 0 inventory.

When trying to do this in theme.liquid, you can customize the SOLD OUT message and it will show the custom message only when you refresh the page , but it will revert back to default SOLD OUT when you changing the variants.

Example: https://diamondshoaljewelers.com/products/emerald-engagement-ring-6?variant=31978866933821

Our Goal: Display Custom message for Lab-Grown Diamond and Natural Diamond Variants only (Instead of Add to Cart or Sold Out button, we want to include a custom message to contact us if you would like to purchase this ring with Lab-Grown Diamond or Natural Diamond). The rest Variants that include Moissanite would have standard add to cart button and only variants with Lab-Grown Diamond or Natural Diamond would show the custom message with a link.

P.S. Language trick would not work, because its changing SOLD OUT globally, but we need to change only in one collection.

Thanks in advance!

 

0 Likes
Highlighted
Shopify Partner
190 38 44

@Wynn1 

Please use js for variant selector condition.

For Design, Development and custom changes Hire Me.
If your problem solved then Like & Accept this Solution.
Email ID: technicalvishvas@gmail.com
0 Likes
Highlighted
New Member
2 0 0

How would I go about using js? 

Do you have an example of code that I can implement?

Can I use js directly in the product-template?

0 Likes
Highlighted
Shopify Partner
190 38 44

Hi @Wynn1 ,

you have to alter the JS which is responsible for showing the "SoldOut" or "Add to Cart" and this might be a function _updateVariatnts() in the theme if you are on debut.Further there is no specific code because each theme has different function.

Thanks
VishvasMishra


For Design, Development and custom changes Hire Me.
If your problem solved then Like & Accept this Solution.
Email ID: technicalvishvas@gmail.com
0 Likes
Highlighted
Excursionist
36 0 16

I have a similar issue. I would like to have the SOLD OUT button link to an external site where that item IS in stock. It is actually a $3000 item that I offer but do not ship. Ideally they would see it in my shop, but be sent to the place that does sell it to make the transaction there. It is for a partner of ours. 

0 Likes
Highlighted

Anyone find an answer to this? I just want to turn the SOLD OUT button into a link (and make sure that it works with products that have variants).

0 Likes