Can't Access POS Cart, Permission Error

Solved
memery
New Member
2 0 0

I'm trying to adapt the Shopify app tutorial to integrate with POS but I've run into an error I can't get past.  I'm using the app bridge provider to inject my credentials and shop origin into the context.  Then I'm testing for the ability to interact with the cart like this:

import { Cart, Group } from '@shopify/app-bridge/actions'
import { Context } from '@shopify/app-bridge-react'
export class Tables extends React.Component {
static contextType = Context;
  componentDidMount() {     this.refreshData();     testForCart(this.context);   }
...
} function testForCart(app) {   app.featuresAvailable(Group.Cart).then(function (state) {     var _ref = state.Cart && state.Cart[Cart.Action.FETCH],         Dispatch = _ref.Dispatch;        if (Dispatch) {       cart.dispatch(Cart.Action.FETCH);     } else {       alert('Cart is not available');       console.log('Cart is not available', state);     }   }); }
However no matter how I access my Shopify app from within the POS app the test always fails.  Is there anything obvious I'm doing wrong here?
 
Also more broadly how do Cart actions interact with the smart grid within the POS app?  There doesn't seem to be away to open the app while editing the cart.
Cart features are only available when opening an embedded app through a link on Point of Sale while editing the cart. To learn more about how to check for cart features, seeFeatures.
When you're talking about the legacy POS app, is there a way to add to the cart without already having something in the cart? My use case is I'm trying to build up a list of products to purchase attached to a table of people, and then I want to cash the table out all at once by putting all the products into the cart.
0 Likes
memery
New Member
2 0 0

I answered my own question re: smart grid.  It seems like you don't want to use a POS link for smart grid, then the Cart Actions seem to work.  I wish the documentation was a little more clear about that.  I'm still not able to do Cart Actions from within Android and the legacy POS app.

0 Likes
policenauts1
Trailblazer
173 13 33

This is an accepted solution.

I posted the exact same question as you two days ago, the documentation here is really lacking and confusing (especially about classic vs. new POS). 

 

For Android, I found the snippet here works (scroll down): https://community.shopify.com/c/Shopify-APIs-SDKs/Issue-with-Embedded-POS-app-AppBridge-Cart-not-fet...