Created
January 28, 2020 15:34
-
-
Save shopifypartners/b98200f26a1db9a44d7be8df1c322d4f to your computer and use it in GitHub Desktop.
Setting POS discounts (with App Bridge)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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