I'm working on my Shopify website and trying to add a product schema, but it just won't save the JSON I input. I'm not super familiar with this type of coding, so I'm feeling a bit lost. I validated the JSON through a validator, so it should be correct. I tried pasting the code between script tags under the main product section, but when I try to save, I keep getting a "json error" message. Here's the code I'm working with:
{
"@context": "https://schema.org/",
"@type": "Product",
"name": "{{ product.title }}",
"description": "{{ product.description | strip_html | escape }}",
"image": "{{ product.featured_image | img_url: 'original' | prepend: 'https:' }}",
"url": "{{ shop.url }}{{ product.url }}",
"sku": "{{ product.sku }}",
"offers": {
"@type": "Offer",
"priceCurrency": "USD",
"price": "{{ product.price | money_without_currency }}",
"availability": "{% if product.available %}https://schema.org/InStock{% else %}https://schema.org/OutOfStock{% endif %}",
"itemCondition": "https://schema.org/NewCondition"
},
"brand": {
"@type": "Brand",
"name": "Chloé Duncan"
}
}
I apologize if the details aren't clear—it's just really frustrating not being able to identify the issue. Any suggestions or insights would be greatly appreciated!
2 Answers
I noticed you're getting an invalid schema tag error. Have you tried adding the schema with the correct `section.liquid`? Sometimes, different sections require data to be formatted differently. I also found a Shopify community thread that might help: https://community.shopify.com/t/how-to-fix-invalid-json-in-tag-schema-error/32717/6. It could give you some insights into how others solved similar issues!
It sounds like you're facing a tough situation! The "json error" could be due to a couple of issues. You mentioned you're not sure where to save the JSON. Make sure you’re putting the schema in the right section of your Shopify theme files—usually in `product.liquid`. Also, double-check the specific error message you're getting, as that can give clues on what's wrong. If you provide more details or a clearer error message, folks here could give more specific advice! Good luck!

Thanks for your advice! I didn't get a specific error code, just the general "json error." I'll try adjusting the placement in `product.liquid` and see if that clears things up!