I'm trying to enhance my Shopify website by adding a product schema but I'm running into issues. I've written out the JSON but it just won't save, even though it validates correctly through a JSON validator. Here's the code I'm trying to implement:
{
"@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 really don't know what I'm missing and it's getting frustrating trying to save it within Shopify only for it to reject with a "JSON error." Any advice would be appreciated!
2 Answers
Looks like you might be dealing with an invalid schema issue! Double-check if you're adding the JSON schema in the right liquid file. It could be that the location is incorrect or that you're missing a schema tag. Have a look at the link below; it might offer some insights on fixing that error:
https://community.shopify.com/t/how-to-fix-invalid-json-in-tag-schema-error/32717/6
It can be tricky figuring it all out! But first off, what specific error message are you getting? Knowing that can help pinpoint the issue better. Also, where exactly in Shopify are you trying to save this schema? If it's not in the right section or if you’re missing a key part, that could be the cause of the problem. Try to clarify those points and see what the error feedback says when you save it.
Related Questions
How To: Running Codex CLI on Windows with Azure OpenAI
Set Wordpress Featured Image Using Javascript
How To Fix PHP Random Being The Same
Why no WebP Support with Wordpress
Replace Wordpress Cron With Linux Cron
Customize Yoast Canonical URL Programmatically