Skip to content

Instantly share code, notes, and snippets.

@shopifypartners
Created January 28, 2020 15:34
Show Gist options
  • Save shopifypartners/b98200f26a1db9a44d7be8df1c322d4f to your computer and use it in GitHub Desktop.
Save shopifypartners/b98200f26a1db9a44d7be8df1c322d4f to your computer and use it in GitHub Desktop.
Setting POS discounts (with App Bridge)
var discountPayload = {
amount: '1',
discountDescription: "$1 off discount",
type: 'flat',
}
var unsubscriber = cart.subscribe(Cart.Action.UPDATE, function (payload: Cart.Payload) {
console.log('[Client] setDiscount', payload);
unsubscriber();
});
cart.dispatch(Cart.Action.SET_DISCOUNT, {
data: discountPayload
});
```
`app.getState('pos.user').then((user) => {
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment