Unparsable Structured Data

Topic summary

A user encountered an “Unparsable Structured Data” error in their Shopify theme, shown through attached screenshots.

Root Cause Identified:
The issue stems from an if statement placed inside a <script> tag (around line 718), which creates invalid HTML/JSON-LD syntax. This relates to Shopify’s recently added structured_data Liquid filter.

Proposed Solutions:

  • Move the conditional logic: Place the entire if statement outside the <script> tag to validate properly
  • Test with fresh theme: Install an unmodified version to determine if customizations caused the problem
  • Alternative approach: Create custom JSON-LD schema to replace the built-in Liquid filter
  • Report bug: Contact Shopify support directly if using an officially supported theme like Dawn

Technical Context:
The structured_data filter was added via recent pull requests to Dawn theme. The error occurs because conditional statements cannot exist within script tags containing structured data markup.

Status: The discussion provides clear troubleshooting steps but awaits confirmation from the original poster on implementation.

Summarized with AI on November 6. AI used: claude-sonnet-4-5-20250929.

Hello. I, for the life of me, can’t figure this out. Can I please get some direction?

Hi @AvyCoffee That indicates something is wrong with the built in structured_data filter that was recently added.

assuming the “product” object being used is an actual product object and not some sort of accidental incorrect variable assignment.

If you’ve customized the code of your theme first try a fresh install of the theme to see if the issue persists in an unmodified theme.

If an unmodified theme does not have the same issue there is something wrong with any code changes done to the theme.

If your using a shopify supported theme such as Dawn contact shopify support directy to report a bug

https://help.shopify.com/en/support/support-type

The interim alternative is to create your own /ld+json schema and replace that liquid filter.

For dawn the structured_data filter was added in these pull requests:

https://github.com/Shopify/dawn/pull/3507

https://github.com/Shopify/dawn/pull/3380

Hey @AvyCoffee

The issue is that you have an if statement inside the script tag which isn’t valid and then if it’s not found, the text “product not found” wouldn’t be valid either. Once you pull the if statement outside of the script tag, your error should go away.

Thank you. Are you saying I should delete the highlighted code? (line 718)

Your entire if statements need to be outside the script tag. So if you want the if statement it should roughly look like:

if product

script open

product structured data

script closed

end if

I can’t tell if you’re on a product file or not. If you are, you shouldn’t need the if statement at all.