Skip to content

Commit 89a4021

Browse files
committed
fix: deal with custom .skip-open prefix on domain param also for kit discounts
1 parent 7e13802 commit 89a4021

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

functions/lib/helpers.js

+4-5
Original file line numberDiff line numberDiff line change
@@ -73,17 +73,16 @@ const getValidDiscountRules = (discountRules, params, itemsForKit) => {
7373
if (!rule || !validateCustomerId(rule, params)) {
7474
return false
7575
}
76+
const isKitDiscount = Array.isArray(itemsForKit) &&
77+
(Array.isArray(rule.product_ids) || (Array.isArray(rule.category_ids)))
7678
if (rule.domain && rule.domain !== params.domain) {
7779
if (params.domain === `${rule.domain}.skip-open`) {
78-
if (checkOpenPromotion(rule)) return false
80+
if (isKitDiscount || checkOpenPromotion(rule)) return false
7981
} else {
8082
return false
8183
}
8284
}
83-
if (
84-
Array.isArray(itemsForKit) &&
85-
(Array.isArray(rule.product_ids) || (Array.isArray(rule.category_ids)))
86-
) {
85+
if (isKitDiscount) {
8786
const checkProductId = item => {
8887
if (
8988
!(rule.product_ids && rule.product_ids.length) &&

0 commit comments

Comments
 (0)