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.
Anchor to RequirementsRequirements
- Your app needs to currently be running on App Bridge 1.x.
Anchor to Modify your app to use the ,[object Object], parameterModify your app to use the host
parameter
host
parameterA 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.
Anchor to In the Shopify adminIn the Shopify admin
The Shopify admin provides the host
parameter as part of the app URL when loading your embedded app:
Anchor to After the OAuth flowAfter 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:
Anchor to Modify your app to use the ,[object Object], enum instead of ,[object Object]Modify your app to use the Action
enum instead of ActionType
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:
Anchor to ExamplesExamples
Anchor to Remove any helpers and types previously marked ,[object Object]Remove any helpers and types previously marked deprecated
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 definition -
getShopOrigin
helper method -
getUrlParams
helper methodIf your code imports and uses any of the helper methods or type definitions above, then you should create your own versions.