Core Issue:
A Shopify store owner needs a quantity box to appear when selecting a specific product variant (custom donation amount), but it only works after manually refreshing the page.
Solution Provided:
A jQuery script was shared that automatically reloads the page when variant selection changes:
Monitors .single-option-selector for changes
Triggers page reload if selected variant ID differs from current
Should be placed in custom.js file under Assets (or theme.js if custom.js doesn’t exist)
Implementation Challenges:
Multiple users struggled with placement (custom.js vs theme.js location)
Different themes use different selectors (radio buttons vs dropdowns)
Some needed theme-specific adaptations (Brooklyn, Simple, Craft, Prestige themes mentioned)
Concerns raised about reload speed and whether refreshing is optimal solution
Key Variations:
For specific products only: wrap script in {% if product.title == 'Product Name' %}
For radio buttons: replace .single-option-selector with appropriate class name
Craft theme users successfully implemented by assigning custom classes to option buttons
Status:
Solution works for many users but requires theme-specific customization. Some participants acknowledge page refresh isn’t ideal but serves as functional workaround when theme’s existing JS functions are insufficient.
Summarized with AI on November 11.
AI used: claude-sonnet-4-5-20250929.
I have a product that is a cash donation product. i’ve added a custom amount variant and want the quantity box to show when the custom variant is chosen. this works but only if i manually refresh the page and most people that visit the sit e aren’t going to do this. how do i get this page to refresh automatically when the variant changes, or is there a better way.
Thanks for the help. Could you tell me where to put the script exactly? I assume this goes in the theme.js file? sorry i’m new to shopify and just learning.
is there a way to specify the page that reloads? it seems to reload every product page that contains variants. i really only need this for one of my products.
They are different way to do this, check this basic one
{% if product.title == ‘Test product name’ %}
// Include your script, but in this you have to place js script in product.liquid or a/to your need.
{% endif%}
@Californiacut I didn’t have a custom.js file either but look under Assets for something like theme.js, or similar and just paste the code at the bottom. I use Minimal and it was under theme.js.
you are awesome!!! That code worked. I did not had a custom.js, but when I out it in the theme.js - everything works fine now.
I will save your contact information in case of a customization or problems, which I can’t do myself. It looks like you are a very knowledgeable & nice guy, too.
I am sure there will be something in the future where I will need help from an expert like you.
I have variants that doesn’t work unless I refresh the page. I went to edit codes found a variant code as you can see in the screen shot I haven’t touched it yet. I am trying to figure it out. If I would to ask for help would you help me with this. My email is jordanvankampen@yahoo.com. I will email this too.
Firstly, I don’t think refreshing the product page on variant change is a solution.
I think you have to check the existing JS functions. But still if you want to use this solution use this script in theme.liquid just before tag and keep notes you have to make changes in it a/to the theme you are using.
Yeah I’m going to ditch the whole them altogether. You’re right that it’s
not a solution to refresh the page. It’s just a feature that would be good
to have but which isn’t available
Hi @Guleria ,
I am currently trying to add your code too because I need to reload the product page when selecting the variant. Can you tell me if the code also works with Craft Theme? I put it into the theme.liquid befor the closing -Tag, but it doesn’t work. And I have no custom.js or theme.js. Can you explain me what i’m doing wrong?
You would really be a big help!
Best regards
Daniela