Liquid/JS to select different default variant (3-Pack) on product page load?

Topic summary

Goal: set the product page to default to the 3‑pack variant on initial load in Shopify’s Dawn theme.

Progress: the helper can programmatically select a specific variant, but initial attempts broke subsequent variant switching. A functional workaround was found: allow Shopify to load the first available variant, then trigger a page refresh to switch to the desired (3‑pack) variant.

Trade-offs of workaround:

  • Page appears to load twice on every visit/return to that product page.
  • Potential impact on perceived speed; otherwise, switching variants and adding to cart continue to work.

Current status: no clean/native solution provided yet; only the refresh-based workaround. The requester is open to paying if substantial work is needed. The helper proposes continuing discussion via email to refine or finalize an approach.

Open questions: is there a robust way to set a default variant in Dawn without a reload and without breaking variant selection behavior? No code snippets were shared in the thread.

Summarized with AI on December 16. AI used: gpt-5.

Hi there,

I’m hoping to implement code to change the default variant selection on page load for this product page in the Dawn theme:

https://guisemen.com/products/green-stick?variant=47615513460969

Let me know how you would recommend going about this… you’re guidance is GREATLY appreciated!

Best,

Will

This is a good one man. Will definitely try this out. Which product do you need to be selected on load the 3 pack or 6 pack?

Hi there! Thanks so much. Hoping to have the page default to the 3 pack on initial page load!

Hey Shadab, no stress if you haven’t been able to, but I was curious whether you’ve had any success?

Hi @guisemen I did try man. But I guess it will take a bit more of looking up. I was able to load item of my choice but then selecting another didn’t change anything.

But honestly this is a good one and I am up for it. Sorry to not update you and thank you for ringing a bell kind of a motivator.

Will update this time as it goes

Thanks

Shadab

No stress – if this would take a substantial amount of work let me know and we can figure out a rate via email.

Hi will,

I kind of got a solution for it, not the best one I will say that it does have a gotcha but it does fulfill the purpose of the project which is to select a variant of our choice by default.

Let me explain how this works. So when you first enter the product page or when the page loads for which we need this feature what happens is Shopify’s code is running and selecting the first available variant but I am refreshing the page again to change the variant to our selection. So the page kind of loads two times which might not be a big issue if your site speed is good and loads faster. So this happens on every load and by every load I mean every time user comes back to this specific product page the page loads twice with our choice of variant selected. Rest of the functionality works pretty fine like if user wants to select other variant and adding to cart, etc.

Just want to let you know how this is working before you throw a deal.

Please reach out via mail for a convenient conversation.

Thanks

Shadab Ali