Hi.
I have developed a shopify remix app. When a merchant installs my app into their store, they need to enable the app embed in theme editor. I need to keep track of that app embed status so that I can notify customer whenever there is a change in the status of app embed. Could anyone help me with like how can I fetch that status…
Hi Narayanan,
You said you want to notify whenever there is a change in the status of app embed - what would be an example of a status change? eg, if you deploy a new version of the app? Or if the merchant deletes the app block/ section?
I have a feature developed using theme app extension and that will be displayed only when the user enables app embed in the theme editor.
There will be a card open to prompt the customer to enable the app embed for the app widget to work in my app’s dashboard.
By keeping track of this status I would be able to notify customer when they disable the app embed unknowingly.
I think you should be able to use the recently launched theme and assets queries for the Admin API to get info on the theme to check if the theme app extension is active or not.
You could follow these steps:
- Retrieve the List of Themes: Use the themes query to get a list of themes in the store. Identify the main or published theme from this list.
- Check for App Blocks: Use the assets query to retrieve the assets of the published theme. Look for JSON template files and check if they include your app’s blocks. App blocks are identified by a unique type that includes your app’s identifier.
- Detect App Embed Blocks: App embed blocks are stored in
settings_data.json
. You can check this file to see if your app’s embed block is listed and whether it is enabled.
There isn’t a specific webhook that fires however when a theme extension is disabled, so you would have to periodically check the theme files with the Admin API to get the status of your extension.
@Liam-Shopify Thank you for the reference. I did it successfully. Thanks for taking time to respond.
1 Like