I actually found this code on here Search Form with Craft Commerce. I had a problem with this code pulling up products that didn't match, and then after creating a new product it worked for a bit and then broke and continued to only pull up the same ones, even if I got rid the values inside with[].
So two questions, how do I enforce that the product has to match BOTH criteria in the with[] and does anyone have any clue about why it would stop refreshing products? I've tried clearing cache in both browser and craftcms.
I apologize if this has been asked before, I've been through multiple previously asked questions with little luck.
{% set spec = craft.request.getParam('a') %}
{% set spec2 = craft.request.getParam('b') %}
{% set category = craft.categories.group('productSpecs') %}
{% set products = craft.commerce.products({
relatedTo: category,
with: [
spec,
spec2,
],
order: "title asc",
}) %}
{% for product in products %}
{{ product.title }}
{% endfor %}