I'm working with Craft Commerce with a set of individual items in a product type and in another, I have packaged sets of the same. The sets (cardSets) have a relation field to select the required individual cards. The code is in the product entry template for the individual card and my intention is to highlight that the single card can be purchased in a set.
I'm using the following code to do a simple reverse relationship but I can't get this to work and I'm not sure if I've got the syntax correct. I'm not seeing any return or error. How do I know if I'm getting an object back?
{% set relatedProduct = craft.commerce.products({
type: 'cardSets',
relatedTo: {
targetElement: product,
field: 'productsInSet'
}
}) %}
{{ relatedProduct.title }}