Ad

Fixed Number Of Blocks In Custom Developed Section On Shopify

- 1 answer

I am developing a custom section for a theme on Shopify. I used the Custom content template (custom-content.liquid) from the Debut theme as a starting point.

I need to have three fixed blocks in it - text, image, and text, in this particular order. I do not want to let people add or remove any of them, or rearrange them.

I played with the schema of my liquid file as well as read the documentation but I cannot find the way to do it. I found max_blocks, which does not work for me.

"presets": [
{
  "name": "Tripple banner",
  "category": "Advanced layout",
  "blocks": [
    {
      "type": "text"
    },
    {
      "type": "image"
    },
    {
      "type": "text"
    }
  ]
}

My text and image are simple blocks with a few settings in them.

An alternative is to create one section without blocks and move all my settings from the blocks I have to that one. It seems cumbersome to me. Is there a better way?

Ad

Answer

The short answer is - not possible without a lot of code.

The way to go is to create a section in a liquid file, which has the three blocks fixed and their settings in the schema in the same file.

Ad
source: stackoverflow.com
Ad