If you do not want to let customers add the product to cart until the option value is selected (for example size specification), please perform the following steps.
<form action="/cart/add" method="post" enctype="multipart/form-data" data-id="{{ product.id }}" class="addToCartForm product-actions-{{ product.id }}">
{% if sold_out %}
<input class="btn btn-primary addToCart add-to-cart-btn" type="submit" value="Unavailable" disabled="disabled" />
{% else %}
{% if variantCount > 1 %}
<input class="btn btn-primary addToCart add-to-cart-btn" type="button" onclick="window.location.href='{{product.url}}'" value="Select options" />
{% else %}
<input type="hidden" name="id" value="{{ product.variants[0].id }}" />
<button type="submit" name="add" class="btn btn-primary addToCart add-to-cart-btn">
<span class="addToCartText">Add to cart</span>
</button>
{% endif %}
{% endif %}
</form>
If you face any problems or need our professional services, please email us at [email protected]
Never miss the latest offers, voucher codes and useful articles delivered weekly in your inbox.