Shopify themes, liquid, logos, and UX
How do I change my product label to say what i have assigned in the custom metafield
I have a custom single line text metafield set up as 'custom.product_badge' which includes 'coming soon' 'staff pick' etc.
How do I make this come up instead of sold out on collection pages?
<product-item class="product-item {% unless product.available %}product-item--sold-out{% endunless %}" {% if reveal %}reveal{% endif %}>
{%- capture product_labels -%}
{%- if product.metafields.custom_badges != blank -%}
{%- for custom_badge in product.metafields.custom_badges.value -%}
<span class="label {% if forloop.index == 1 %}label--custom{% else %}label--custom2{% endif %}">{{ product.metalfields.custom_badge }}</span>
{%- endfor -%}
{%- else -%}
{%- for tag in product.tags -%}
{%- if tag contains '__label' -%}
<span class="label label--custom{% if tag contains '__label2' %}2{% endif %}">{{ tag | split: ':' | last }}</span>
{%- endif -%}
{%- endfor -%}
{%- endif -%}
{%- unless product.available -%}
<span class="label label--subdued">{{ 'collection.product.sold_out' | t }}</span>
{%- endunless -%}
Hi Erin,
You'll need to properly call the metafield via resource.metafields.namespace.key. From what I see, you are missing the namespace.
If you'd like me to fix this for you and have it working properly, I’d be happy to assist for a flat fee of $20. Feel free to reach out if you have any questions.
Good luck!
By investing 30 minutes of your time, you can unlock the potential for increased sales,...
By Jacqui Sep 11, 2024We appreciate the diverse ways you participate in and engage with the Shopify Communi...
By JasonH Sep 9, 2024Thanks to everyone who participated in our AMA with 2H Media: Marketing Your Shopify St...
By Jacqui Sep 6, 2024