Last active
June 20, 2022 00:33
-
-
Save hezninja/b9848cbef7998ecacdbafa2a8100a326 to your computer and use it in GitHub Desktop.
Assign a specific Shopify collection to a product for a custom breadcrumb using the collection handle and a metafield
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% assign productCollections = product.collections | map:'handle' %} | |
{% if productCollections contains product.metafields.my_fields.breadcrumb %} | |
<a href="/collections/{{product.metafields.my_fields.breadcrumb}}">{{collections[product.metafields.my_fields.breadcrumb].title}}</a> | |
{%- endif -%} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment