ShippingEligibilityChecker

ShippingEligibilityChecker

The ShippingEligibilityChecker class is used to check whether an order qualifies for a given ShippingMethod.

Example

const minOrderTotalEligibilityChecker = new ShippingEligibilityChecker({
    code: 'min-order-total-eligibility-checker',
    description: 'Checks that the order total is above some minimum value',
    args: {
        orderMinimum: ConfigArgType.MONEY,
    },
    check: (order, args) => {
        return order.total >= args.orderMinimum;
    },
});

Signature

class ShippingEligibilityChecker<T extends ShippingEligibilityCheckerArgs = {}> implements ConfigurableOperationDef {
  constructor(config: {
        args: T;
        check: CheckShippingEligibilityCheckerFn<T>;
        code: string;
        description: string;
    })
}

Members

constructor

method
type:
(config: { args: T; check: CheckShippingEligibilityCheckerFn<T>; code: string; description: string; }) => ShippingEligibilityChecker