Liquid novice here looking for some help. I have two collections and one product in each collection that have similar names:
(collection) Snack Bars > (product)Chocolate Chip
(collection) Protein Bars > (product)Mint Chocolate Chip
I am trying to hide/show content specific to those items (within the same page) based on the collection and product handle. I've tried the following, but this shows both items even though == should be specific, it's not and displays as it considers chocolate-chip and chocholate-chip-mint to be a match, but it's not:
{% if product.handle == "chocolate-chip" %} // do something {% endif %}
I've tried this, but no go:
{% if collection == "protein-bars" && product.handle == "mint-chocolate-chip" %} // do something {% endif %}
I've also tried this but it doesn't work:
{% if product.handle == "mint-chocolate-chip" | within: collections.protein-bars %} // do something {% endif %}
Ultimately, I just want to verify that if I'm on a product page, my logic checks:
- That the product handle in the URL matches (exactly) mint-chocolate-chip.
- That the item is a part of the collection : protein-bars (not snack bars)
https://www.blakesseedbased.com/collections/snack-bars/products/chocolate-chip
https://www.blakesseedbased.com/collections/protein-bars/products/mint-chocolate-chip
You can see on the Mint Chocolate Chip page the logic believes "chocolate-chip" is a product match, and is displaying the information for chocolate-chip on the mint-chocolate-chip page (in the white section under the product display).