PromotionOrderAction

PromotionOrderAction

PromotionOrderAction

Represents a PromotionAction which applies to the Order as a whole.

Example

// Applies a percentage discount to the entire Order
const orderPercentageDiscount = new PromotionOrderAction({
    code: 'order_percentage_discount',
    args: { discount: 'percentage' },
    execute(order, args) {
        return -order.subTotal * (args.discount / 100);
    },
    description: 'Discount order by { discount }%',
});

Signature

class PromotionOrderAction<T extends PromotionActionArgs = {}> extends PromotionAction<T> {
  constructor(config: PromotionOrderActionConfig<T>)
}

Members

constructor

method
type:
(config: PromotionOrderActionConfig<T>) => PromotionOrderAction