Add to cart button unavailable if first variant/option is sold out

Highlighted
Tourist
27 0 1

Hi,

I'm going mad very quickly trying to fix this!

Example: http://iamvibes.myshopify.com/products/test-product-two - pw is "awthea".

As you can see, as the first option (small) is sold out, the add to cart button is greyed out. It stays unclickable even if you select another variant that is in stock. Also, the swatch selected now doesn't seem to dictate which size gets added to the cart. It just automatically adds the first available size. This was working okay not long ago so I'll try and see what broke it.

Also, I'm using this swatch code (http://docs.shopify.com/manual/configuration/store-customization/showcasing-products/add-color-swatc...) to display the sizes and Caroline's ajaxify code to keep the user on the page when adding items to the cart. Unfortunately the connection between the select element and the swatch seems to have been broken :(

If any of you could help, or just point me in a different direction to ones I've looked at, that would be great. I'd really appreciate any ideas and advise you have on the code I'm using.

0 Likes
Highlighted
Tourist
27 0 1

No ideas or advice? I'm fully aware I've probably stuffed up somewhere, but I need some pointers as to where :(

0 Likes
Highlighted
Tourist
27 0 1

All is now well.

For anyone that somehow falls upon this lonely one-way conversation, here is mistake I had made: I'd changed the swatch container class (in the swatch.liquid snippet) from "swatch" to "swatch-inner" and this stopped the js being able to reference this element and tie the select and the radio buttons together...I think haha

Also, this docs post worked wonderfully for selecting the first available vairant, which is very handy if the first option is sold out: http://docs.shopify.com/support/your-website/themes/how-to-select-first-variant-to-not-look-sold-out

Take care of yourselves, and each other :)

0 Likes
Highlighted
Shopify Expert
69 2 6

@Matt_Willmott  here https://shopify.dev/tutorials/customize-theme-how-to-add-a-pick-an-option-to-drop-downs I fount the  solution it's works for me with debut theme customization 

0 Likes