on my new project I decided to show in the page grid variants rather than products, but I am experiencing difficulties, since I am supposed to filter the record set based on a category relation of the product (which holds the variants) rather then on the variants themselves.
If I had to show products in the grid, this would be sufficient:
{% paginate craft.products.relatedTo(currentCategory).limit(12) as pageInfo, pageProducts %}
But since I want to output the variants my starting point is:
{% paginate craft.variants.relatedTo(...?...).limit(12) as pageInfo, pageProducts %}
.
A variant holds a relation named product
which I do not know how to use in the query builder.
I tried to play a bit with where
, having
and so on but no luck.
Any suggestions?