How can I use the Icons With Text section on the product pages using Metafields? I only want to use it on some products, not all!
Thanks
A user wants to display the “Icons With Text” section on product pages in the Dawn theme, but only when specific metafields are populated—not on all products.
Proposed Solution:
{% if template.name contains 'product' %} followed by {% if product.metafields.custom.demo_field.value == "your value" %}Implementation Options:
The solution allows selective display based on whether the metafield contains the expected value, giving control over which products show the icon section.
How can I use the Icons With Text section on the product pages using Metafields? I only want to use it on some products, not all!
Thanks
Hello @xnyjyh , You have to make a conditional code for it to check its value of the metafield. Try the code below.
{% if template.name contains 'product' %}
{% if product.metafields.custom.demo_field.value == "your value" %}
// your code of that section //
{% endif %}
{% endif %}
// Try to put this code with make a new custom section for this or else go with your existing section file //
Feel free to reach out if you have any questions or need assistance.
Best regards.