After following the App Bridge tutorial here : https://help.shopify.com/en/api/embedded-apps/app-bridge/oauth ,
I am able to authenticate my application in Shopify Admin section.
After instantiating App Bridge object, when I check featuresAvailable() on this object, it seems most are disabled.
See code below:
var AppBridge = window['app-bridge']; var createApp = AppBridge.createApp; var actions = AppBridge.actions; var Redirect = actions.Redirect; //const apiKey = 'foobar'; const redirectUri = 'https://foo.ngrok.io' + '/shopify/authorization/callback'; const scope = 'read_products, write_products, read_inventory, write_inventory, read_locations, read_orders, read_all_orders, read_draft_orders, write_draft_orders, write_orders, write_customers, write_orders, write_checkouts, read_collection_listings, unauthenticated_read_product_listings, unauthenticated_read_product_tags, unauthenticated_write_checkouts, unauthenticated_write_customers, unauthenticated_read_content, read_users, write_users'; const permissionUrl = '/oauth/authorize?client_id=' + apiKey + '&scope=' + scope + '&redirect_uri=' + redirectUri; // If the current window is the 'parent', change the URL by setting location.href if (window.top == window.self) { window.location.assign('https://' + shopOrigin + '/admin' + permissionUrl); // If the current window is the 'child', change the parent's URL with Shopify App Bridge's Redirect action } else { const app = createApp({ apiKey: apiKey, shopOrigin: shopOrigin, }); app.featuresAvailable().then(function (state) { $("#container").html(JSON.stringify(state)); // see output below }); }
The state returns the below output:
{"Scanner":{"OPEN::NFC":{"Subscribe":false,"Dispatch":false},"CAPTURE":{"Subscribe":true,"Dispatch":false},"OPEN::CAMERA":{"Subscribe":true,"Dispatch":true}},"Cart":{"UPDATE":{"Subscribe":false,"Dispatch":false},"REMOVE_LINE_ITEM_DISCOUNT":{"Subscribe":false,"Dispatch":false},"FETCH":{"Subscribe":false,"Dispatch":false},"REMOVE_PROPERTIES":{"Subscribe":false,"Dispatch":false},"ADD_LINE_ITEM":{"Subscribe":false,"Dispatch":false},"REMOVE_LINE_ITEM_PROPERTIES":{"Subscribe":false,"Dispatch":false},"REMOVE_DISCOUNT":{"Subscribe":false,"Dispatch":false},"REMOVE_LINE_ITEM":{"Subscribe":false,"Dispatch":false},"SET_LINE_ITEM_PROPERTIES":{"Subscribe":false,"Dispatch":false},"ADD_CUSTOMER_ADDRESS":{"Subscribe":false,"Dispatch":false},"CLEAR":{"Subscribe":false,"Dispatch":false},"SET_DISCOUNT":{"Subscribe":false,"Dispatch":false},"SET_PROPERTIES":{"Subscribe":false,"Dispatch":false},"UPDATE_LINE_ITEM":{"Subscribe":false,"Dispatch":false},"SET_CUSTOMER":{"Subscribe":false,"Dispatch":false},"REMOVE_CUSTOMER":{"Subscribe":false,"Dispatch":false},"SET_LINE_ITEM_DISCOUNT":{"Subscribe":false,"Dispatch":false},"UPDATE_CUSTOMER_ADDRESS":{"Subscribe":false,"Dispatch":false}},"Share":{"SHOW":{"Subscribe":true,"Dispatch":true},"CLOSE":{"Subscribe":true,"Dispatch":false}}
As you can see pretty much all properties are set to FALSE. How do I enable them ?
Solved! Go to the solution
Success.
Hi @runTimeZero
We recently added a notice when accessing cart features https://help.shopify.com/en/api/embedded-apps/app-bridge/actions/features#cart. You could subscribe to Features.ActionType.UPDATE in your use case.
Subject | Author | Latest Post |
---|---|---|
Subject | Author | Posted |
---|---|---|
25m ago | ||
an hour ago | ||
an hour ago | ||
2 hours ago | ||
2 hours ago |
User | Count |
---|---|
257 | |
165 | |
134 | |
67 | |
39 |