Error: Invalid JSON in tag 'schema'

Fabian0
New Member
3 0 0

Hi, i am trying to add this code but when i save is not possible, i can't find the error, i had serch every where but i can't fix it.
I had use the Json Fromatter but i can't fix. The code is :

<p class="line-item-property__field">
<label for="nome-imagem">Nome + imagem</label>
<input required class="required" id="nome-imagem" type="text" name="properties[Nome + imagem]">
</p>

0 Likes
Ninthony
Shopify Partner
1637 224 615

There's a problem with the structure of the schema in whatever file you're trying to save. Can you post the schema? It'll look like this in the bottom of your section:

{% schema %}
//schema code will be here, there is a problem with the structure
{% endschema %}
If my solution helped you, please like and accept as solution!
If you'd like to make any edits to your store, please send me a personal message and we can discuss what you'd like to accomplish :D
0 Likes
Fabian0
New Member
3 0 0

I need to put the code in here:

 

{% schema %}
{
"name": "Product pages",
"class": "product-section",
"settings": [
{
"type": "header",
"content": "Product photos"
},
{
"type": "select",
"id": "image_layout",
"label": "Image display",
"default": "stacked",
"options": [
{
"value": "stacked",
"label": "Stacked"
},
{
"value": "thumbnail",
"label": "Thumbnail"
}
]
},
{
"type": "select",
"id": "product_photo_alignement",
"label": "Image alignement",
"default": "left",
"options": [
{
"value": "left",
"label": "Left"
},
{
"value": "right",
"label": "Right"
}
]
},
{
"type": "checkbox",
"id": "enable_zoom",
"label": "Enable image zoom",
"default": true
},
{
"type": "header",
"content": "Product details"
},
{
"type": "checkbox",
"id": "product_vendor",
"label": "Show vendor",
"default": false
},
{
"type": "checkbox",
"id": "product_title_size",
"label": "Big product tite",
"default": false
},
{
"type": "select",
"id": "product_header_alignement",
"label": "Alignement",
"default": "",
"options": [
{
"value": "",
"label": "Left"
},
{
"value": "text-center",
"label": "Center"
}
]
},
{
"type": "select",
"id": "product_selector",
"label": "Variant picker type",
"options": [
{
"value": "radio",
"label": "Button"
},
{
"value": "select",
"label": "Dropdown"
}
]
},
{
"type": "checkbox",
"id": "quantity_enabled",
"label": "Show quantity picker"
},
{
"type": "checkbox",
"id": "button_cart_icon",
"label": "Show button icon",
"default": true
},
{
"type": "checkbox",
"id": "enable_payment_button",
"label": "Show dynamic checkout button",
"info": "Lets customers check out directly using a familiar payment method. [Learn more](https://help.shopify.com/manual/using-themes/change-the-layout/dynamic-checkout)",
"default": false
},
{
"type": "checkbox",
"id": "show_description",
"label": "Show description",
"default": true
},
{
"type": "checkbox",
"id": "social_sharing_products",
"label": "Enable product sharing",
"default": true
},
{
"type": "checkbox",
"id": "show_product_tags",
"label": "Show product tags",
"default": true
}
]
}
{% endschema %}

0 Likes
Ninthony
Shopify Partner
1637 224 615

That JSON code is valid. If I'm understanding you correctly, you're trying to put the original code you posted inside the JSON. You cannot do that, JSON structure must be strictly followed and you cannot mix HTML in with JSON. What exactly are you trying to do?

If my solution helped you, please like and accept as solution!
If you'd like to make any edits to your store, please send me a personal message and we can discuss what you'd like to accomplish :D
0 Likes
Fabian0
New Member
3 0 0

I am trying to put a new variant on my product. Usually people do that and it works. I don't understand why it's not working for me.
I used de UI elements generator.

0 Likes
Ninthony
Shopify Partner
1637 224 615

I can assure you that no one is putting HTML inside of their {% schema %} tags. It looks to me like you are trying to pass a line item property from the product, your code should go inside the product form in your product-template.liquid -- this forum post covers it in quite some detail regarding an engraving option, but you can apply it to whatever property you want:

https://community.shopify.com/c/Shopify-Design/Product-pages-Get-customization-information-for-produ...

If my solution helped you, please like and accept as solution!
If you'd like to make any edits to your store, please send me a personal message and we can discuss what you'd like to accomplish :D
0 Likes