SHOPIFY POS : subscribing to cart object

Solved
Highlighted
New Member
16 0 0

After the client installs my app on POS (IPAD) app, I redirect them to a post_authentication.html page which has the following script.  As you can see in this script I am creating an appBridge object and would like to subscribe to cart changes. 

 

However I noticed that NONE of the features are actually available for me subscribe or dispatch.

 

Is there some hard configuration that I am missing ? 

 

// post_authenication.js
const AppBridge = window['app-bridge'];
const actions = window['app-bridge'].actions;
const createApp = AppBridge.createApp;
const Cart = actions.Cart;
const Group = actions.Group;

try {
    const app = createApp({
        apiKey: "abc",
        shopOrigin: 'foo-test.myshopify.com'
    });
    var cart = Cart.create(app);

    app.featuresAvailable().then(function (state) {
        // For some reason all subscribe and dispatch flags are FALSE 
     console.log(state);
     /*
      {
         Cart: {
                  UPDATE: { subscribe: false, dispatch: false},
                  FETCH: { subscribe: false, dispatch: false},
                  ...
              },
          } 
      });

} catch (err) {
    alert(err);
}

0 Likes

Success.

Shopify Staff
Shopify Staff
26 11 1

Hi @runTimeZero ,

 

We recently added a note 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.

 
0 Likes