Features action set allows you to find out what features are available in the current app context, and to request currently unavailable features.
Create an app and import the
Features module from
@shopify/app-bridge/actions. Note that we'll be referring to this sample application throughout the examples below.
Subscribe to feature availability updatesAnchor link to section titled "Subscribe to feature availability updates"
App.featuresAvailable()Anchor link to section titled "App.featuresAvailable()"
app.featuresAvailable() returns a promise that evaluates to the entire set of available features for the app. The feature set is represented as an object containing groups, the actions within each group, and the permissions for each action (
Dispatch is equal to
true, then you will be able to send that type of action within your app. Likewise if
Subscribe is equal to
true, then you will be able to subscribe to dispatches of that type of action.
If a group is not present in the state then it can be assumed that all actions contained in that group are also not available.
If you want to limit your resulting state to a subset of groups, then pass in a group parameter.
Multiple group filters are also supported by using
If you experience feature availability errors while trying to access Cart actions on Point of Sale, try wrapping that code in a subscription to
Features Update actionAnchor link to section titled "Features Update action"
|Description||Dispatches when a feature's available state changes.|
||Object||The availability state of the features in the main context.|
||Object||The availability state of the features in the modal context.|
Features Request actionAnchor link to section titled "Features Request action"
|Description||Requests for a feature to be enabled. May result in an authorization dialog to appear, depending on the platform it is dispatched on.|
If an action is not available when you call
app.featuresAvailable(), then you can use the
APP::FEATURES::REQUEST action to request either a group of actions or a single action inside a group to be enabled. This is particularly useful when the app is running on a mobile device and requesting a hardware feature, such as the scanner, that needs authorization from the user.
The workflow for enabling a feature includes two parts: subscribing to
APP::FEATURES::REQUEST::UPDATE and dispatching
APP::FEATURES::REQUEST is the input and
APP::FEATURES::REQUEST::UPDATE is the output.
Requesting Camera Scanner actions:
||String||The feature group that you would like to enable.|
||String?||An optional action within the group to enable. All actions within the group will be enabled if an action is not specified.|
Features Request Update actionAnchor link to section titled "Features Request Update action"
|Description||Dispatches with the result of a features request action.|
||Object||The new state of the requested feature.|
Application contextAnchor link to section titled "Application context"
Shopify App Bridge applications can be opened in different places. We refer to each of these places as a context. Each context makes a set of features available to the application. Different contexts can provide different feature sets.
For instance, the Modal context has a different set of features available than the Main context.
To check which context an application is in, you can use
app.getState(). Read more about