fix(medusa): applicableness of discounts with conditions not related to customer groups (#1534)
Discounts with conditions not related to customer groups prevent the discount from being applicable to customers (#1534)
This commit is contained in:
1 parent
7700b28e8d
commit
a10ac19d8e
1 file changed
+3
-2
@@ -4,13 +4,13 @@ import {
|
|||||||
EntityTarget,
|
EntityTarget,
|
||||||
In,
|
In,
|
||||||
Not,
|
Not,
|
||||||
Repository,
|
Repository
|
||||||
} from "typeorm"
|
} from "typeorm"
|
||||||
import { Discount } from "../models"
|
import { Discount } from "../models"
|
||||||
import {
|
import {
|
||||||
DiscountCondition,
|
DiscountCondition,
|
||||||
DiscountConditionOperator,
|
DiscountConditionOperator,
|
||||||
DiscountConditionType,
|
DiscountConditionType
|
||||||
} from "../models/discount-condition"
|
} from "../models/discount-condition"
|
||||||
import { DiscountConditionCustomerGroup } from "../models/discount-condition-customer-group"
|
import { DiscountConditionCustomerGroup } from "../models/discount-condition-customer-group"
|
||||||
import { DiscountConditionProduct } from "../models/discount-condition-product"
|
import { DiscountConditionProduct } from "../models/discount-condition-product"
|
||||||
@@ -282,6 +282,7 @@ export class DiscountConditionRepository extends Repository<DiscountCondition> {
|
|||||||
.where("discon.discount_rule_id = :discountRuleId", {
|
.where("discon.discount_rule_id = :discountRuleId", {
|
||||||
discountRuleId,
|
discountRuleId,
|
||||||
})
|
})
|
||||||
|
.andWhere("discon.type = :type", { type: DiscountConditionType.CUSTOMER_GROUPS })
|
||||||
.getMany()
|
.getMany()
|
||||||
|
|
||||||
// in case of no discount conditions, we assume that the discount
|
// in case of no discount conditions, we assume that the discount
|
||||||
|
|||||||
Reference in new issue
Block a user