Skip to content

Commit

Permalink
refactor(core): Rename method to align with existing convention
Browse files Browse the repository at this point in the history
Relates to #1150
  • Loading branch information
michaelbromley committed Oct 19, 2021
1 parent 715a2e0 commit 11fcc42
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export class ShippingLine extends VendureEntity {
this.adjustments = this.adjustments.concat(adjustment);
}

removeAdjustments() {
clearAdjustments() {
this.adjustments = [];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ export class OrderCalculator {
p.test(ctx, order).then(Boolean),
);
if (applicableOrderPromotions.length) {
order.shippingLines.forEach(line => (line.adjustments = []));
order.shippingLines.forEach(line => line.clearAdjustments());
for (const promotion of applicableOrderPromotions) {
// re-test the promotion on each iteration, since the order total
// may be modified by a previously-applied promotion
Expand All @@ -365,9 +365,10 @@ export class OrderCalculator {
}
}
} else {
// If there is no applicable promotion for shipping, we should remove already assigned adjustment from shipping lines.
// If there is no applicable promotion for shipping,
// we should remove already assigned adjustment from shipping lines.
for (const shippingLine of order.shippingLines) {
shippingLine.removeAdjustments();
shippingLine.clearAdjustments();
}
}
}
Expand Down

0 comments on commit 11fcc42

Please sign in to comment.