Incorrect variant being added to cart

Topic summary

A store owner is experiencing a cart issue where only the first product variant gets added regardless of which option customers select. The problem appears to affect all variant selections, not just preventing multiple variants of the same product.

Root cause identified:

  • Custom JavaScript code in assets/custom.js is interfering with the theme’s default functionality
  • This custom code adds “please select” options and disables the add-to-cart button until all variants are chosen
  • However, it prevents the original theme code from updating the selected variant
  • Result: When the cart button becomes enabled, it still references the first variant internally

Next steps:

  • The custom code needs revision
  • Since it’s not part of the default theme, likely added by a developer or third party
  • Store owner has limited coding knowledge, may need technical assistance to resolve
Summarized with AI on October 30. AI used: claude-sonnet-4-5-20250929.

Hello,

I am working on setting up a store for my company but have encountered the issue of only the first variant being added to the cart, regardless of the selection made. I initially thought the issue was that we were not able to add different variants of the same product to the cart but then realised that it was just adding the same product repeatedly.

I have spent about 2 days on Google trying to find similar problems and their solutions, but I am not having much luck. All I have been able to find is that it might be an issue with the JavaScript not being linked correctly or not being accessed when a different variant is selected, and I know next to nothing about coding, so I can’t be sure that the same solutions will appear in my store.

Any advice will be greatly appreciated!

Thanks &:slight_smile:

Can you share a link to your store (preview link or a storefront password if your storefront is password protected).

Otherwise it’s not possible to diagnose.

Thank you so much :slightly_smiling_face:

1 Like

Ok, you have this assets/custom.js code which adds “please select” options and disables the cart button until all selectors are selected by visitor.

However, while doing so it prevents original theme code from running, so it does not update selected variant as selections are made.

So, when cart button is enabled internally it’s still the first variant selected.

This code needs to be revised and since it’s not a part of default theme I guess somebody did it for your site?