Displaying Metafield Data in Custom HTML block

Topic summary

Trying to render a product metafield in a Shopify Empire theme “custom HTML” block triggered the error: Setting ‘custom_html’ can’t include Liquid syntax (‘{{’, ‘}}’, ‘{%’ or ‘%}’) without valid dynamic sources.

Key context:

  • Liquid is Shopify’s templating language; metafields are custom data fields attached to products.
  • Liquid tags are not allowed in “custom HTML” blocks but are allowed in “custom liquid” blocks.

Progress updates:

  • Liquid worked in a “custom liquid” block for product.description and product_videos.value.
  • A specific metafield (key named 3d_animations) still failed even in “custom liquid.”

Resolution (two issues):

  • Metafield keys starting with a number (e.g., 3d_animations) are problematic; renaming the key to start with a letter fixed access.
  • Using a “custom liquid” block (not “custom HTML”) is required to render Liquid tags.

Outcome:

  • Metafield content displays correctly after renaming the key and switching the block type to “custom liquid.”

Next steps:

  • Suggested to file a feature request about clearer error messaging and guidance on metafield key naming.

Status: Resolved; no open questions.

Summarized with AI on December 12. AI used: gpt-5.

I am using the Shopify Empire theme for my store, https://cozyglowstoves.com. I’m currently working on adding a multi-line text metafield section into a HTML custom block on my product page for a certain template. I’ve done this before without issue. I’ve created the metafield, but when I go to enter it into the HTML block using {{ product.metafields.custom.3d_animations }} I get the error, “Setting ‘custom_html’ can’t include Liquid syntax (‘{{’, ‘}}’, ‘{%’ or ‘%}’) without valid dynamic sources.” There is data in the metafield for the products tied to this product template. I’ve even tried modifying per ChatGBT’s suggestion using {{ product.metafields.custom.3d_animations | raw }} and it still returns the same error.

As a test, I took a similar coding that is currently working on another block, {{
product.metafields.custom.product_videos.value }}, pasted it into the new block, and it’s returning an error as well.

I then tried even entering in {{ product.description }}, and once again still getting the “Setting ‘custom_html’ can’t include Liquid syntax (‘{{’, ‘}}’, ‘{%’ or ‘%}’) without valid dynamic sources.” error.

Again, there is data in the metafield… so I can’t understand what’s going on. Especially since I have similar code working on the same product template already.

Can anyone shed some light on this issue???

Hi @CGS-PDigital :waving_hand: Is the “HTML custom” block setting type set to liquid?

Try the code in a custom section that accepts liquid to validate the logic.

When I insert a new “custom liquid” block using {{ product.description }} and {{ product.metafields.custom.product_videos.value }}, it works.

But still no luck using, {{ product.metafields.custom.3d_animations }}, {{ product.metafields.custom.3d_animations.value }}, or even {{ product.metafields.custom.3d_animations | raw }}.

It’s boggling my mind:

I figured it out. I had two issues.

One: Apparently Shopify does not like numeric values when you’re naming metafields. When I was trying to enter {{ product.metafields.custom.3d_animations }} it didn’t like it because of the value “3”. When I renamed it to artificial reality coding I finally got it to work.

Two: Apparently you cannot use {{ in custom HTML blocks. When I changed the block type to a custom liquid block I was finally able to get it to display.

Thank you for the help though!

1 Like

File a feature request either with a support advisor or through the partner support or on the community.shopify.dev, or all three :smirking_face: .

There’s probably a blurb somewhere about starting mf names|keys with numbers but the error messages created a misleading rabbit hole for you to stumble through.