Craft Commerce: Variable "product" does not exist My shop has one product. As such there isn't much point in me having a page displaying all products.

When I paste in my template code for my single product into Cart Commerce's main index template I get the error Variable "product" does not exist on the following code:

{% for purchasable in product.variants %}

    &lt;option {% if purchasable.stock &lt;= 0 and purchasable.unlimitedStock == false %}disabled {% endif %} value="{{ purchasable.purchasableId }}"&gt;{{ purchasable.description }} {{ purchasable.price|currency(cart.currency) }}&lt;/option&gt;

{% endfor %}


Why is this being thrown up and how do I remedy this?
product will only be available by default if you're viewing the template set in the CP under that products type settings:



If you want to display your product elsewhere on your site you will need to set it to a variable like so:

{% set myProduct = craft.commerce.products.first() %}


you can then loop through this product's variants

{% for purchasable in myProduct.variants %}

    &lt;option {% if purchasable.stock &lt;= 0 and purchasable.unlimitedStock == false %}disabled {% endif %} value="{{ purchasable.purchasableId }}"&gt;{{ purchasable.description }} {{ purchasable.price|currency(cart.currency) }}&lt;/option&gt;

{% endfor %}