ShippingMethod

ShippingMethod

ShippingMethod

A ShippingMethod is used to apply a shipping price to an Order. It is composed of a ShippingEligibilityChecker and a ShippingCalculator. For a given Order, the checker is used to determine whether this ShippingMethod can be used. If yes, then the ShippingMethod can be applied and the calculator is used to determine the price of shipping.

Signature

class ShippingMethod extends VendureEntity implements ChannelAware, SoftDeletable {
  constructor(input?: DeepPartial<ShippingMethod>)
  @Column({ type: Date, nullable: true, default: null })
    deletedAt: Date | null;
  @Column() code: string;
  @Column() description: string;
  @Column('simple-json') checker: ConfigurableOperation;
  @Column('simple-json') calculator: ConfigurableOperation;
  @ManyToMany(type => Channel)
    @JoinTable()
    channels: Channel[];
  async apply(order: Order) => Promise<ShippingCalculationResult | undefined>;
  async test(order: Order) => Promise<boolean>;
}

Members

constructor

method
type:
(input?: DeepPartial<ShippingMethod>) => ShippingMethod

deletedAt

property
type:
Date | null

code

property
type:
string

description

property
type:
string

checker

property
type:
ConfigurableOperation

calculator

property
type:
ConfigurableOperation

channels

property
type:
Channel[]

apply

async method
type:
(order: Order) => Promise<ShippingCalculationResult | undefined>

test

async method
type:
(order: Order) => Promise<boolean>