Why does my custom theme add wrong sizes to the cart?

I have a issue with a custom theme. The issue is that when you click on a shirt it allows you to select sold out sizes and no matter what you add to the cart it adds the first size that’s available. So if a shirt is sold out in size S and XL and the only available are M and L, if you select to add size L it will add size M to the cart.

Hello @MexicanTacos92

yes because the variant adding on button click is “first available variant” which is not changing when you change variants.

i can help you with get this done.

Hi @MexicanTacos92 ,

Please send your site and if your site is password protected, please send me the password. I will check it.

Hello @MexicanTacos92

The add to cart button condition should be mentioned as first available variant in your code so only it’s adding the product which is available.

To be frankly I do not know anything about coding since another person made the theme but that person isn’t being responsive.

Can you share your Store URL so that I can check it and provide you the solution to fix the issue?