|
|
@@ -7,7 +7,7 @@ export const orderPercentageDiscount: AdjustmentActionDefinition = {
|
|
|
code: 'order_percentage_discount',
|
|
|
args: [{ name: 'discount', type: 'percentage' }],
|
|
|
calculate(order, args) {
|
|
|
- return [{ amount: (order.totalPrice * args.discount) / 100 }];
|
|
|
+ return [{ amount: -(order.totalPrice * args.discount) / 100 }];
|
|
|
},
|
|
|
description: 'Discount order by { discount }%',
|
|
|
};
|
|
|
@@ -19,7 +19,7 @@ export const itemPercentageDiscount: AdjustmentActionDefinition = {
|
|
|
calculate(order, args) {
|
|
|
return order.items.map(item => ({
|
|
|
orderItemId: item.id,
|
|
|
- amount: (item.totalPrice * args.discount) / 100,
|
|
|
+ amount: -(item.totalPrice * args.discount) / 100,
|
|
|
}));
|
|
|
},
|
|
|
description: 'Discount every item by { discount }%',
|