situation
A embedded app has following extensions and plans.
extensions
- checkout ui extension
- account ui extension
- admin ui extension
plans
I want those extensions to make enable or disable based on plan a merchant select.
|
minimal plan |
standard plan |
premium plan |
checkout ui extensions |
enabled |
enabled |
enabled |
account ui extensions |
disabled |
enabled |
enabled |
admin ui extensions |
disabled |
disabled |
enabled |
my understanding
all extensions are installed automatically once merchant install my app that mean there is no way to manage that auto installation based on app plan.
question
How to enable / disable extensions based on billing plan merchant select ?
All extensions need to call admin graphql api everytime the extension shows to detect current active subscription (app plan merchant currently select) state ?
For admin ui extensions, you can look at shouldRender. Account & Checkout UI Extensions would require loading an app owned metafield in the extension TOML and conditionally rendering the extension of the metafield value met your requirements. There’s currently no method to conditionally hide the app blocks in the editor app panel but you can use the metafield value and api.extensions.editor.type

to load a message to non-qualified merchants in the editor.
2 Likes
@Gil-Shopify
Thank you for your support !
Judging from your answer and my further investigation, each extension should check different resources to handle own feature based on app subscription.
admin ui extension can read app subscription state directly using graphql. ( ShouldRender API )
App block can use app-data metafield through available_if property.
Customer Account UI extension can use app-data metafield through appMetafield that requested in the shopify.exntension.toml
Notably …
Checkout UI extension cannot use app-data metafield through appMetafield that requested in the shopify.exntension.toml.
so that we need to use general metafield instead, that can be read and written by others. This could be a risk if we handle checkout ui extension feature based on this metafield’s value.
Reading different resource might be complicated for me 