Skip to content

Commit

Permalink
✨ Fetch cart coupon from items if qs not set
Browse files Browse the repository at this point in the history
  • Loading branch information
williamchong committed Sep 27, 2024
1 parent a57087b commit 79822d4
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/pages/shopping-cart/book.vue
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,15 @@ export default {
'shoppingCartBookProductList',
'shoppingCartBookItems',
]),
coupon() {
if (this.$route.query.coupon) {
return this.$route.query.coupon;
}
// stripe only support one coupon
const firstCoupon = this.shoppingCartBookItems.find(item => item.coupon)
.coupon;
return firstCoupon || '';
},
purchaseEventParams() {
let { locale } = this.$i18n;
if (locale === 'zh-Hant') {
Expand Down Expand Up @@ -333,7 +342,7 @@ export default {
gadSource: this.gadSource,
items: this.shoppingCartBookItems,
email: this.walletEmail,
coupon: this.$route.query.coupon,
coupon: this.coupon,
giftInfo,
});
if (url) {
Expand Down

0 comments on commit 79822d4

Please sign in to comment.