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