How to Make Shopify Product Options Required?

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.

  1. Log into your admin panel and navigate to Online Store > Themes > Edit HTML/CSS > Snippets > Add a new snippet:

    Edit HTML/CSS

  2. Name the snippet snippet-add-to-cart and press Create a snippet:

    Create a snippet

  3. Paste this code to the snippet area and Save:
     <form action="/cart/add" method="post" enctype="multipart/form-data" data-id="{{ }}" class="addToCartForm product-actions-{{ }}">

    {% 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>


    {% endif %}

    {% endif %}

  4. Select Snippets > product-grid-item.liquid and add this code:


  5. Make sure to save the changes in all the files and refresh the site to see the changes.

    see the changes

If you face any problems or need our professional services, please email us at [email protected]

Join our Newsletter

Never miss the latest offers, voucher codes and useful articles delivered weekly in your inbox.