From 234be4e3079dfbea1bf26accf68f691507b71c65 Mon Sep 17 00:00:00 2001 From: Sebastian Mateos Nicolajsen <80953876+sebastiannicolajsen@users.noreply.github.com> Date: Thu, 9 Sep 2021 09:40:41 +0200 Subject: [PATCH] Feat/update discount on draft order (#349) * only looked for rules when existing * removed logging --- packages/medusa/src/services/totals.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/medusa/src/services/totals.js b/packages/medusa/src/services/totals.js index 6b98692b96..7802999585 100644 --- a/packages/medusa/src/services/totals.js +++ b/packages/medusa/src/services/totals.js @@ -222,7 +222,7 @@ class TotalsService extends BaseService { getAllocationItemDiscounts(discount, cart) { const discounts = [] for (const item of cart.items) { - if (discount.rule.valid_for.length > 0) { + if (discount.rule.valid_for?.length > 0) { discount.rule.valid_for.map(({ id }) => { if (item.variant.product_id === id) { discounts.push(