Feat/update discount on draft order (#349)

* only looked for rules when existing

* removed logging
This commit is contained in:
Sebastian Mateos Nicolajsen
2021-09-09 09:40:41 +02:00
committed by GitHub
parent da329359a9
commit 234be4e307

View File

@@ -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(