How can I limit app block addition to once per page?

How can I limit app block addition to once per page?

wb1
Shopify Partner
64 2 18

Is there a way to limit the number of times a merchant can "(+) Add block" from the app blocks? I'd like the merchant to only be able to add each block once. In the example screenshot below "Gallery" and "List" can be added many times.

 

I tried limit: 1 on the {% schema %} object but limit is not a valid attribute.

 

Docs: https://shopify.dev/apps/online-store/theme-app-extensions/getting-started

 

 Screen Shot 2022-02-14 at 11.54.29 AM.png

Replies 3 (3)

Almeida
Shopify Partner
4 0 4

Good question. Should be good to have a schema entry to limit instance of an app block

like :

blocks-limit : 1

 

link to current value possible : https://shopify.dev/docs/apps/online-store/theme-app-extensions/extensions-framework#schema

 

A message should appear when user try to add new block :

You have reach the maximum number of blocks to display(use) for this app.

 

Could be also a part of a paid plan of the app :

plan1 : display up to 1 block

plan2: display up to 3 blocks

etc

 

and then the message could be :

You have reach the maximum number of blocks to display(use) for this app. If you want to use more blocks you can upgrade your app plan subscription here.

JackL
Shopify Partner
17 0 14

Hi @wb1 I needed to have the same limit too, do you have any solution on this?

HarshvardhanP
Shopify Partner
9 0 0

hey @wb1  did you get anything on this? I am also searching for the same.