Why do product variants default to the first option in the cart?

Why do product variants default to the first option in the cart?

DuganAndDame
Visitor
2 0 0

Hello,

 

We are experiencing an issue where any item with a variant does not get the correct variant added to cart. It always defaults to the first variant. I have triple checked everything and it seems as if everything is set up correctly, but it just is not working no matter what I do. Here is just one product that has variants:

 

https://dugananddame.com/collections/garnishes/products/dehydrated-lemon-wheels

 

Not matter what quantity our customers choose, it defaults to the lowest quantity variant. 

 

I cannot figure out why this is happening! Is there anyone who could possible assist me?

 

Thanks in advance!

Replies 2 (2)

Kani
Shopify Partner
468 125 232

Hi @DuganAndDame 

 

Kani_0-1669546618351.png

 

The input named 'id' has not changed.

Kani_1-1669546630308.png

When option changed, you should use javascript to change the id value too

Kani_2-1669546728592.png

 

 

Hey!! ʕ ᵔᴥᵔ ʔ
Please click 'Like' and ' Accept as Solution' to encourage me to continue sharing my expertise. ♡
If you need any technical assistance, feel free to send me a DM. You no longer have to search for answers without getting a response. 🙂
DuganAndDame
Visitor
2 0 0

Hi @Kani 

 

Thank you so much! 

 

I was wondering if you can explain how I can do that. I am not the best with code and I don't want to mess anything up, so if you could give me a better idea of how to accomplish that, I would greatly appreciate it.

 

Thanks!