Solved

dawn theme - metafields - icon with text section on product page

xnyjyh
Explorer
200 0 9

IM trying to get the Icon With Text section to show only on certain products. But I'm unable to find tutorials for the is. Anyone have a tutorial on this topic?

 

Thanks

Accepted Solution (1)

wo
Shopify Partner
73 20 17

This is an accepted solution.

You can add a metafields for a product and then add text to the metafields input box on the product page.
Then add Icon with Text to the product. Then the textbox uses the added metafields

wo_0-1712023619649.png

 

View solution in original post

Replies 9 (9)

AnneLuo
Shopify Partner
210 44 50

Hello, @xnyjyh 

Your requirements should require custom code.

If this is helpful, please Like and Accept the solution.
Want to modify or custom changes on store? Let me help.
- Feel free to contact me on luomingxia@shinetechsoftware.com.
xnyjyh
Explorer
200 0 9

You're kidding me, right?! that's your answer?... maybe you need to read my question, again...

AnneLuo
Shopify Partner
210 44 50

So if you need, I can help you customize the code directly. Your requirements are not detailed, so it's impossible to tell you the code directly.

If this is helpful, please Like and Accept the solution.
Want to modify or custom changes on store? Let me help.
- Feel free to contact me on luomingxia@shinetechsoftware.com.
xnyjyh
Explorer
200 0 9

This is the "if"

            {%- if product.metafields.custom.show_unisex == true -%}
  {%- endif -%}

  This is the code in the icon with text .liquid I need to apply it to. 

  {%- unless heading_1_empty -%}
    <li class="icon-with-text__item">
      {%- if block.settings.image_1 == null -%}
        {%- render 'icon-accordion', icon: block.settings.icon_1 -%}
      {%- else -%}
        <img
          src="{{ block.settings.image_1 | image_url }}"
          {% if block.settings.image_1.alt != blank %}
            alt="{{ block.settings.image_1.alt | escape }}"
          {% else %}
            role="presentation"
          {% endif %}
          height="auto"
          width="auto"
          loading="lazy"
        >
      {%- endif -%}
      <span class="h4 inline-richtext">
        {{- block.settings.heading_1 -}}
      </span>
    </li>
  {%- endunless -%}

I only need this icon and text section to show when I select true or false metafield in products setup pages. Do not want it to show on all products. Hope that makes sense. 

wo
Shopify Partner
73 20 17

This is an accepted solution.

You can add a metafields for a product and then add text to the metafields input box on the product page.
Then add Icon with Text to the product. Then the textbox uses the added metafields

wo_0-1712023619649.png

 

xnyjyh
Explorer
200 0 9

It wouldnt work that way. I need to be able to hide or unhide or move the icon with text section on the default product page in site builder

wo
Shopify Partner
73 20 17

Why doesn't it work? I should have understood your needs correctly.

 

I added a metafields and added text to the metafields input box on the product page

wo_4-1712026329268.png

This product displays icons and text.

 

wo_5-1712026442075.png

 

Product pages without added text do not display icons and text

wo_6-1712026511123.png

 

 

 

 

 

xnyjyh
Explorer
200 0 9

Maybe i not understanding. So with the metaield tag I have that I made in the metafields section (product.metafields.custom.show_unisex). i do not need this?

Can you elaborate a little please. thanks

xnyjyh
Explorer
200 0 9

Figured it out. Ive done few metafields, but never this way before, thanks! 🙂