Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
On a certain product type or collection, if you click on a variant that has 0 for inventory, I want to show a custom button vs "coming soon" which is the default in the language file.
I've tried
if collection.handle == 'example' ... or if product.type == "ABC"
But I'm guessing when you click on a variant it does not do any checks for that, only on page load? So do i need to find the code that is executed when clicking a variant option - if, so where would that be?
Any help would be appreciated!
Where code is located varies wildly between themes leaving that detail out complicates discussing theme development.
Generally it's in global.js for Dawn based themes, or script.js, theme.js etc etc
Some may have it more granular and be in a variant.js component file, or within the product-forms sections/snippet code.
Contact paull.newton+shopifyforum@gmail.com for the solutions you need
Save time & money ,Ask Questions The Smart Way
Problem Solved? ✔Accept and Like solutions to help future merchants
Answers powered by coffee Thank Paul with a ☕ Coffee for more answers or donate to eff.org
thanks @PaulNewton - I was able to find it, but there is way to much JS for variants for me to get a handle on what's going 🙂 - wondering if there is a better way?
Learn how to build powerful custom workflows in Shopify Flow with expert guidance from ...
By Jacqui May 7, 2025Did You Know? May is named after Maia, the Roman goddess of growth and flourishing! ...
By JasonH May 2, 2025Discover opportunities to improve SEO with new guidance available from Shopify’s growth...
By Jacqui May 1, 2025