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, HasCustomFields, Translatable {
constructor(input?: DeepPartial<ShippingMethod>)
@Column({ type: Date, nullable: true }) @Column({ type: Date, nullable: true })
deletedAt: Date | null;
@Column() @Column() code: string;
name: LocaleString;
description: LocaleString;
@Column('simple-json') @Column('simple-json') checker: ConfigurableOperation;
@Column('simple-json') @Column('simple-json') calculator: ConfigurableOperation;
@Column() @Column()
fulfillmentHandlerCode: string;
@ManyToMany(type => Channel) @JoinTable() @ManyToMany(type => Channel)
@JoinTable()
channels: Channel[];
@OneToMany(type => ShippingMethodTranslation, translation => translation.base, { eager: true }) @OneToMany(type => ShippingMethodTranslation, translation => translation.base, { eager: true })
translations: Array<Translation<ShippingMethod>>;
@Column(type => CustomShippingMethodFields) @Column(type => CustomShippingMethodFields)
customFields: CustomShippingMethodFields;
async apply(ctx: RequestContext, order: Order) => Promise<ShippingCalculationResult | undefined>;
async test(ctx: RequestContext, order: Order) => Promise<boolean>;
}
Extends
Implements
- ChannelAware
- SoftDeletable
- HasCustomFields
- Translatable
Members
constructor
method
type:
(input?: DeepPartial<ShippingMethod>) => ShippingMethod
deletedAt
property
type:
Date | null
code
property
type:
string
name
property
type:
LocaleString
description
property
type:
LocaleString
checker
property
type:
ConfigurableOperation
calculator
property
type:
ConfigurableOperation
fulfillmentHandlerCode
property
type:
string
channels
property
type:
Channel[]
translations
property
type:
Array<Translation<ShippingMethod>>
customFields
property
type:
CustomShippingMethodFields
apply
method
type:
(ctx: RequestContext, order: Order) => Promise<ShippingCalculationResult | undefined>
test
method
type:
(ctx: RequestContext, order: Order) => Promise<boolean>