Sanjay Goswami
Sanjay Goswami

Reputation: 858

How to remove blocks section from Shopify schema

How could I remove blocks section from shopify schema code? I simply tried to delete it but was not able to save due to a strange error. Please see the code below:

{% schema %}
{
    "name": "Featured Collection",
    "settings": [
        {
            "type": "collection",
            "id": "featured_collection",
            "label": "Collection"
        },
        {
            "type": "text",
            "id": "collection_button_label",
            "label": "Button Label",
            "default": "Learn More"
        }
    ],
    "blocks": [
        { 
            "type": "section",
            "name": "Section",
            "settings": [

            ]
        }
    ],
    "presets": [
        {
            "name": "Featured Collection",
            "category": "Product"
        }
    ]
}
{% endschema %}

I can save the above code without any error. But When I remove the code section of "blocks", I get the following error:

Error: New schema is incompatible with the current setting value. Invalid type value for block '1577470637989'. Type must be defined in schema.New schema is incompatible with the current setting value. Invalid type value for block '1577470668608'. Type must be defined in schema

Upvotes: 1

Views: 2163

Answers (1)

Bilal Akbar
Bilal Akbar

Reputation: 4930

The error is kind of self explanatory. The error message

Error: New schema is incompatible with the current setting value. Invalid type value for block '1577470637989'. Type must be defined in schema.New schema is incompatible with the current setting value. Invalid type value for block '1577470668608'. Type must be defined in schema

It states that new schema that you are trying to save is not compatible with existing data you have. Shopify does not know what to do with existing blocks of those types which you want to remove.

So just remove those blocks from Shopify Customizer first and then edit the schema.

Upvotes: 2

Related Questions