Add Dynamic Content Option to Plain Text Block

AIW12345
Visitor
1 0 0

Hi everyone,

 

Thanks for reading, hoping you can assist. In short, I am trying to add dynamic content option to a specific field.

 

We have added a Section to our page which is a Scrolling Promotion. The section has an option for two Blocks: add an Image or Announcement (Text). The Image Block has the option to be dynamic content linked to a metafield, but the Text AnnouncementBlock does not have this option.

 

We don't want to use images and the text announcement needs to be unique/dynamic, as we host a number of different brands on the store. Can someone please help me alter the Text Announcement field to allow the option of dynamic content?

 

I would be so grateful, thank you!

Replies 2 (2)

PaulNewton
Shopify Partner
6339 579 1345

Hi @AIW12345  Afaik, currently static sections in theme.liquid wont work dynamic sources.

 

You'd have to add the announcement bar as a dynamic section to EVERY resource template and I believe still need to add a resource type setting to that section for metafields of that resource type to be inferred into a dynamic source. I.e. a product picker to show a product metafield

https://shopify.dev/docs/themes/architecture/settings/dynamic-sources 

 

Use custom-liquid settings instead

Alternatively convert the text setting to a custom liquid setting and put in liquid code there to refer to each pages data, metafield using logic.

 

For example in dawns announcement-bar.liquid change the text blocks type to liquid

https://github.com/Shopify/dawn/blob/main/sections/announcement-bar.liquid#L296 

https://shopify.dev/docs/themes/architecture/settings/input-settings#liquid 

Then use text with liquid : This {{ page.metafield.announcements.brand_name.value }} special is {{  page.metafield.announcements.brand_offering.value }} 

Or some such contrivance.

 

 

If you need this customization then contact me by mail for services.
ALWAYS please provide context, examples: store url, theme name, post url(s) , or any further detail.
Contact info in signature.

 

 

Good Hunting.

Save time & money ,Ask Questions The Smart Way


Confused? Busy? Get the solution you need paull.newton+shopifyforum@gmail.com


Problem Solved? ✔Accept and Like solutions to help future merchants

Answers powered by coffee Buy Paul a Coffee for more answers or donate to eff.org


Jahid-KlinKode
Excursionist
145 1 4

Hi @AIW12345, learn how to add dynamic content options in plain text blocks in Shopify by watching this insightful video tutorial: https://www.youtube.com/watch?v=xGVtvlJT8Y4.