Hi everyone,
I’ve just implemented a code into price.liquid to display product badges using metafields, however it is showing up on both product page AND collection grid.
Initially I put this code into price.liquid, in the hopes that the new badge would show up next to the built-in SALE and SOLD OUT badges. It is showing up perfectly next to the built-in badges in product pages but it also shows up in the collection grid next to the price, as a badge.
I have tried putting the code into main-product.liquid but this makes it only shows up ABOVE the built in badges, not inline and next to the built in badges like I want it to.
What am I be doing wrong?
This is the code I have used in both price.liquid and main-product.liquid
{% comment %}ADD NEW METAFIELD{% endcomment %}
{% assign product_badge_best_seller = card_product.metafields.custom.product_badge_best_seller %}
{% if product.metafields.custom.product_badge_best_seller != blank %}
{{ product.metafields.custom.product_badge_best_seller | metafield_tag }}
{% endif %}