We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
DISCOUNTS_DISABLE_OPEN
1 parent 7ee98ca commit c34f53cCopy full SHA for c34f53c
packages/apps/discounts/lib-mjs/helpers.mjs
@@ -1,6 +1,9 @@
1
/* eslint-disable default-param-last, no-use-before-define */
2
import ecomUtils from '@ecomplus/utils';
3
4
+const { DISCOUNTS_DISABLE_OPEN } = process.env;
5
+const isOpenPromotionEnabled = DISCOUNTS_DISABLE_OPEN?.toLowerCase() !== 'true';
6
+
7
const validateDateRange = (rule) => {
8
// filter campaings by date
9
const timestamp = Date.now();
@@ -62,6 +65,7 @@ const matchFreebieRule = (rule, params = {}) => {
62
65
};
63
66
64
67
const checkOpenPromotion = (rule) => {
68
+ if (!isOpenPromotionEnabled) return false;
69
return !rule.discount_coupon && !rule.utm_campaign
70
&& (!Array.isArray(rule.customer_ids) || !rule.customer_ids.length);
71
0 commit comments