fix: widen range of discount limit conditions (#895)

This commit is contained in:
Sebastian Rindom
2021-12-08 09:42:45 +01:00
committed by GitHub
parent ed04132533
commit 7d6fc5c9e1

View File

@@ -1047,7 +1047,7 @@ class CartService extends BaseService {
if (discount.usage_limit) {
discount.usage_count = discount.usage_count || 0
if (discount.usage_limit === discount.usage_count) {
if (discount.usage_count >= discount.usage_limit) {
throw new MedusaError(
MedusaError.Types.NOT_ALLOWED,
"Discount has been used maximum allowed times"