A space to discuss online store customization, theme development, and Liquid templating.
Hi everyone,
Is there a way to find whether our app embed block is activated or not for a merchant?
We want to guide the merchant on the onboarding so we really need this.
Thanks in advance,
Koorosh
@kooroshkia i was looking same things. do you solution for that
@mojtaba-hengam Thanks for the answer i will do that. do you any code reference please share that.
do i have to call every time assets api ?
Basically, every time you want to know the app embed block is enabled/disabled, you need to make a call.
But if you want to get notified whenever the merchant enables/disables the block, some webhooks could help (almost sure, but not 100%), in particular theme/update. So, if you register to this webhook, whenever the theme gets updated, you can read this asset again and you know if merchant has enabled/disabled the block. But you should test it and see if Shopify calls your webhook whenever the merchant enables/disables app embed block. I am interested to know the answer and I hope it works.
Regarding the code reference, I am not sure which language you are using for your app. But here is the reference to the admin Rest api to get the asset. You should put the asset_key equal to config/settings_data.json.
@mojtaba-hengam thanks lot for the deep answers.
I checked it today. Neither "themes/update" nor "shop/update" webhook topics send requests when an embed block is toggled by the merchant. I think these are for events like for e.g. when merchants renames their themes in the theme editor. Apparently, there is no way to know the right time to hit the admin api to check the status of the embed block.