dawn theme - have ICON WITH TEXT shown only when metafields is used

219 0 11

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!



Reply 1 (1)

Shopify Partner
129 19 14

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.

Helpful? then please Like and Accept the Solution.
For any inquiries, please feel free to contact via WhatsApp and Email: sales@dolphinwebsolution.com.
For more information visit our website Dolphin Web Solution.