In Products (Craft Commerce), I've set custom fields. Some are texts, some are related to a Category. Actually, there's 2 different categories per variant...
In order to draw the fields, I need to retrieve each category of each variant.
Looping thru variants to show text fields is no brainer, but I can't manage to get any category object.
Here's the variant definition:
And the code I put to show what's going on.
{% for variant in product.getVariants() %}
{{ variant.id }} - {{ variant.sku }} - {{ variant.vendorLength }}
{# This show a CategoryQuery Object #}
{{ variant.attributeGrainWay }}<br><hr>
{# This show a CategoryQuery Object as well... #}
{% set abc = craft.categories.group('woodGrainOrientation').relatedTo(variant.attributeGrainWay) %}
<pre>{{ abc }}</pre>
No matter what, I can't manage to get what I need.
Here's a sample output.
As always, your help is greatly appreciated.
Sylvain