tried everything, how i can make it default as an error at the opening of product page, so only when it will select if a user select a variant otherwise it should show as a error!
Elaboration - (First variant of the product (Color, Size etc.) should not be selected by default. When a user clicks on Add to cart or Buy Now button without selecting any variant, it should show an error message below the variant option “Please select an option first*”.)
{%- if section.settings.product_variant_handle == ‘product_variant_swatch_option’ -%}
{%- if product.available and product.variants.size > 1 -%}
{% for option in product.options %}
{%- include ‘swatch’ with option -%}
{% endfor %}
{%- endif -%}
{%- endif -%}
{%- if section.settings.product_variant_handle == ‘product_variant_swatch_option’ or section.settings.product_variant_handle == ‘product_variant_without_option’ -%}