Dedicated to the Hydrogen framework, headless commerce, and building custom storefronts using the Storefront API.
Hello!
I'm currently researching app blocks(Theme app extension). Is there anyway to activate an app block automatically without Theme Editor?
With app embed block i can use a deep link but the docs (https://shopify.dev/apps/online-store/theme-app-extensions/extensions-framework#simplified-installat...) pointed out: "Deep linking is compatible only with app embed blocks. You can't deep link to an app block.".
So if it's not possible with app blocks then is there a way to work around this? Any help would be appreciated. Thank you.
Solved! Go to the solution
This is an accepted solution.
Since Shopify documentation never fully explains anything and whenever I ask no one answer, I have to find solutions to every Shopify problem myself (real pain). This is no exception.
To solve this, first, you deploy your app blocks and add it manually using Theme Editor. Then you go to the "Edit code" section in your Theme, go to "product.json", and scroll down til you find the App Blocks property (really easy to identify because the name of the property is a really long id).
Then to activate it automatically, copy that property, duplicate the product.json using Asset API, and also use Asset API to add that property to that duplicate file (remember to add the property's name to the block_order property as well). Finally, assign the product template to that product.json duplicate template/file.
Why do you have to duplicate the product.json file instead of just editing the file itself? Because Shopify will just reset the code for default files anyway, which is understandable but it doesn't notify you.
Why no one answers? Shopify supports redirects me to the forum and here no one answers. Strange!
This is an accepted solution.
Since Shopify documentation never fully explains anything and whenever I ask no one answer, I have to find solutions to every Shopify problem myself (real pain). This is no exception.
To solve this, first, you deploy your app blocks and add it manually using Theme Editor. Then you go to the "Edit code" section in your Theme, go to "product.json", and scroll down til you find the App Blocks property (really easy to identify because the name of the property is a really long id).
Then to activate it automatically, copy that property, duplicate the product.json using Asset API, and also use Asset API to add that property to that duplicate file (remember to add the property's name to the block_order property as well). Finally, assign the product template to that product.json duplicate template/file.
Why do you have to duplicate the product.json file instead of just editing the file itself? Because Shopify will just reset the code for default files anyway, which is understandable but it doesn't notify you.