Shopify App bridge

SriVathson
Tourist
5 0 1
We are trying to get the cart object using the POS link in the embedded app. We have configured our URL in the Embedded POS app->Add POS Link section. When we are trying to get the features available, the function does not execute the code inside the apps.features available section.
 
In the below code, when we try to check the cart features available, the statement inside this function not executing. When we check the available features inside the function, the dispatch object values come as false. 
 

 

 

Promotions.js
import { Frame,AppProvider, Layout, Page, Toast } from '@shopify/polaris';
import '@shopify/polaris/dist/styles.css';
import React, { Component } from 'react';
import createApp from '@shopify/app-bridge';
import { Features, Group, Scanner, Cart, Redirect } from '@shopify/app-bridge/actions';

class Promotions extends React.Component {
render() {
const app = createApp({
apiKey: '{{shopify_api_key}}',
shopOrigin: '{{store_name}}',
});

var cart = Cart.create(app);
const subscribe_data = "Render";
cart.subscribe(Cart.Action.UPDATE, function (payload) {
console.log('[Client] cart update', payload);
subscribe_data = "Render Sucessfully!";
});

app.featuresAvailable(Group.Cart).then(function (state) {
subscribe_data = "cart Render !";
});

return (
<Frame>
<Page>
<div>{subscribe_data}</div>
<div id="testing"></div>
</Page>
</Frame>
);
}
}
export default Promotions;

 

Kindly let us know is there anything, we are missing on our side.

Thanks.
0 Likes