First variant only being added in cart using swatches for size and color every time for all products

Shopify Partner
24 0 0

I recently added a modified version of the store october 2020.

When I select other variants from the swatch list, system is adding the first variant only into the cart. It same for all products, all time. I need to fix that whatever variants is selected that only must go to the Cart.

Here you can check that I've selected small size variant and it does not add because already added first variant in cart.

Please check:

Here small size also should be add but it's not working right now.

Also I've implemented the same code in other theme but  that store theme is not updated,  it is before October 2020.

And the code is working fine in that store theme.

I need a help.

Please help to solve this.