Hi, I want to create one collection with the following conditions:
- Include products with tag: “Cups” and inventory greater than 0
and
- Include products with tag: “Water Bottle” and inventory greater than 0
and
- Do not include any other products with inventory greater than 0.
This is not possible with the Collection Condition settings in Shopify admin.
Is there a way round it or any way I can do it myself with code?
Thanks
1 Like
This is PageFly - Free Landing Page Builder. I would love to provide my recommendations for your store based on 6 years of providing solutions for about 100.000 active Shopify merchants.
Regards your concern to create an custom condition by code, here’s the code based on what you need, hope this will help:
{% assign productTags = product.tags | join: ', ’ %}
{% if productTags contains ‘Cups’ and product.available %}
Okay.. I found the tag
{% else %}
{% endif %}
You can change the tag name ‘Cups’ to “Water Bottle” to reuse the code.
If you feel my answer is helpful, like it or mark it as a solution. Let me know if you have any questions.
Best regards,
PageFly
1 Like
Thank you so much for your reply… I’m using Warehouse theme - I’ve been trying to find out where to add the code. In Templates I can only see: collection.json
but I’m not sure if this would be the right place. In Sections, there’s: collection-list.liquid and collection-with-image.liquid.
Any ideas welcome. Thanks again.
Still other solutions? Maybe some apps from store