Hi there,
I’m trying to create a custom product badge, which pulls in a metafield value if a specific tag (for now just hijacking the “new” tag) is added to the product. The {{ product.metafields.custom.plastic_pieces }} works when I test it on a product page, (and have also tried prefixing with “products.” like the other badges) so I’m guessing it’s something else. Please help!
{% comment %}
@param itemType {Product}
Product to apply badge to.
{% endcomment %}
{% if itemType.available %}
{% if itemType.compare_at_price_min > itemType.price_min %}
{{ 'products.product.on_sale' | t }}
{% endif %}
{% capture new-tag %}{{ 'products.product.new' | t }}{% endcapture %}
{% if itemType.tags contains new-tag %}
{{ product.metafields.custom.plastic_pieces }}
{% endif %}
{% else %}
{{ 'products.product.sold_out' | t }}
{% endif %}