Why am I getting an 'Invalid value for type in block' error in Shopify?

Why am I getting an 'Invalid value for type in block' error in Shopify?

jake_mitchell
Shopify Partner
120 2 66

Hi, 

I have a snippet file called 'SHLTR_mf-product-info.liquid'

 

This is designed to be added to the main-product section as a block. 

 

In main-product.liquid I have defined this in the schema as 

 

{
     "name": "Metafield product info",
     "type": "mf-product-info",
     "limit": 1
    },

This is then referenced in the main body of main-product.liquid with 

 

 {% when 'mf-product-info' %}
    {% render 'SHLTR_mf-product-info' %}

However, whenever I add the block in the customiser I get an error that says "Invalid value for type in block 'dcaa088a-5259-4268-98db-a8224ae20493'. Type must be defined in schema'

It will render the block but the moment you hit save it disappears again. 

Does anyone know why this happening? 

Reply 1 (1)

PageFly-Oliver
Shopify Partner
878 190 186

Hi @jake_mitchell ,

if you using blocks and use {% for block in section.blocks %} and {% case %} {% when %}
then you can use 

{% when 'Metafield product info' %}

one important
You want to use "type mt-product-info" then on the main-product. liquid you need to declare formats before use
Declare in main-product.liquid with blocks and use in product.json with format through blocks and block_order

Hope my solution works perfectly for you!

Best regards,

Oliver | PageFly

 

Please let me know if it works by giving it a Like or marking it as a solution!


PageFly - #1 Page Builder for Shopify merchants.


All features are available from Free plan. Live Chat Support is available 24/7.