I have a products object:
assign rel_products = collection.products
How can I check for a specific product within this object? By id
preferably. I’m doing this check so I can continue
in a for loop:
{% if rel_products contains related_product.id %}
{% continue %}
{% endif %}
This code above isn’t working.
2
Answers
I am not very familiar with liquid but the problem in your code snippet looks like you are assigning the collection to the variable rel_products, so you will have to loop through that and then check the id in each iteration. Possibly something like this?
I think this might be the solution you needed.