New to Craft Commerce and doing something pretty template intensive.
I am following this https://craftcommerce.com/support/product-taxonomy and https://craftcommerce.com/support/products-related-to-category
My categories group handle "productCategories" My categories field handle "whatFinish" Categories so far are "metallic" and "standard"
This code returns a short list of both categories from the page above
{% nav category in product.productDepartments %}
<li>
<a href="{{ category.url }}">{{ category.title }}</a>
{% ifchildren %}
<ul>
{% children %}
</ul>
{% endifchildren %}
</li>
{% endnav %}
When I use this code with any of a variety of options to replace(category) I get a template error with a variable issue.
{# Fetch all of the products related to this category #}
{% set products = craft.commerce.products.relatedTo(category) %}
{# Output them #}
{% for product in products %}
<a href="{{ product.url }}">{{ product.title }}</a>
{% endfor %}
Examples things I have tried:
{# Fetch all of the products related to this category #}
{% set products = craft.commerce.products.relatedTo(standard) %}
{# Output them #}
{% for product in products %}
<a href="{{ product.url }}">{{ product.title }}</a>
{% endfor %}
{# Fetch all of the products related to this category #}
{% set products = craft.commerce.products('whatFinish').relatedTo(standard) %}
{# Output them #}
{% for product in products %}
<a href="{{ product.url }}">{{ product.title }}</a>
{% endfor %}
{# Fetch all of the products related to this category #}
{% set products = craft.commerce.products('standard').relatedTo(whatFinish) %}
{# Output them #}
{% for product in products %}
<a href="{{ product.url }}">{{ product.title }}</a>
{% endfor %}
Before to get all of the products (not desired as I want just the ones form a specific category) my code worked fine:
<div class="row ">
{% for product in craft.commerce.products.limit(5).find() %}
<div class="col-md-4 col-sm-4 col-xs-12">
<div class=" text-center">
{% set image = product.slider.first() %} {% if image %}
<img alt="product.title" class="" src="{{ image.getUrl({ height: 250 }) }}"> {% endif %}
<div class="title">
<h5 class="mb0">{% if product.url %}{{ product.link }}{% else %}{{ product.title }}{% endif %}</h5>
</div>
</div>
</div>
<!--end three col-->
{% endfor %}
Do I need to bracket the category code with something I am not aware of? Sorry just completely lost here. I was directed to post form the support email.
Steph