@ecomplus/storefront-components 1.0.0-beta.183 → 1.0.0-beta.184
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -156,6 +156,7 @@ export default {
|
|
|
156
156
|
|
|
157
157
|
parseDiscountOptions (listResult = []) {
|
|
158
158
|
let extraDiscountValue = 0
|
|
159
|
+
let hasFreebies = false
|
|
159
160
|
if (listResult.length) {
|
|
160
161
|
let discountRule, invalidCouponMsg, invalidAlertVariant
|
|
161
162
|
listResult.forEach(appResult => {
|
|
@@ -193,7 +194,14 @@ export default {
|
|
|
193
194
|
invalidCouponMsg = response.invalid_coupon_message
|
|
194
195
|
}
|
|
195
196
|
if (this.canAddFreebieItems) {
|
|
196
|
-
|
|
197
|
+
const freebieProductIds = response.freebie_product_ids
|
|
198
|
+
if (Array.isArray(freebieProductIds) && freebieProductIds.length) {
|
|
199
|
+
hasFreebies = true
|
|
200
|
+
addFreebieItems(this.ecomCart, freebieProductIds)
|
|
201
|
+
if (this.localCouponCode) {
|
|
202
|
+
this.$emit('update:coupon-code', this.localCouponCode)
|
|
203
|
+
}
|
|
204
|
+
}
|
|
197
205
|
}
|
|
198
206
|
}
|
|
199
207
|
})
|
|
@@ -213,7 +221,7 @@ export default {
|
|
|
213
221
|
}
|
|
214
222
|
this.$emit('set-discount-rule', discountRule)
|
|
215
223
|
} else {
|
|
216
|
-
if (this.localCouponCode) {
|
|
224
|
+
if (this.localCouponCode && !hasFreebies) {
|
|
217
225
|
this.alertText = invalidCouponMsg || this.i19invalidCouponMsg
|
|
218
226
|
this.alertVariant = invalidAlertVariant || 'warning'
|
|
219
227
|
} else {
|