Migrate your app from Shopify App Bridge 1.x to Shopify App Bridge 2.0
Migrating from Shopify App Bridge 1.x to App Bridge 2.0 makes sure that your app is performant, flexible, and has the latest features. App Bridge 2.0 includes a more streamlined interface for actions and an improved architecture for tree-shaking.
Requirements
Anchor link to section titled "Requirements"- Your app needs to currently be running on App Bridge 1.x.
Modify your app to use the host
parameter
Anchor link to section titled "Modify your app to use the host parameter"A new query parameter named host
has been introduced with the release of App Bridge 2.0. The base64-encoded host
parameter represents the domain that is currently hosting your embedded app.
In the Shopify admin
Anchor link to section titled "In the Shopify admin"The Shopify admin provides the host
parameter as part of the app URL when loading your embedded app:
After the OAuth flow
Anchor link to section titled "After the OAuth flow"The host
query parameter is also available to the app as part of the GET
request made to the allow-listed redirect URL specified.
You need to store the host
parameter for use with the updated createApp
method:
Modify your app to use the Action
enum instead of ActionType
Anchor link to section titled "Modify your app to use the Action enum instead of ActionType"To streamline the library and simplify the interface, the ActionType
enum has been removed from App Bridge actions. The Action
enum is now used exclusively. If you need to change your code for this update, then it will be on action subscriptions:
Remove any helpers and types previously marked deprecated
Anchor link to section titled "Remove any helpers and types previously marked deprecated"The following helpers and type definitions have been marked as deprecated in App Bridge 1.0. In App Bridge 2.0, they are fully removed:
HandlerData
type definitiongetShopOrigin
helper methodgetUrlParams
helper method
If your code imports and uses any of the helper methods or type definitions above, then you should create your own versions.