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)
@JoinTable()
channels: Channel[];
@OneToMany(type => ShippingMethodTranslation, translation => translation.base, { eager: true })
translations: Array<Translation<ShippingMethod>>;
@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
(input?: DeepPartial<ShippingMethod>) => ShippingMethod
deletedAt
Date | null
code
string
name
LocaleString
description
LocaleString
checker
ConfigurableOperation
calculator
ConfigurableOperation
fulfillmentHandlerCode
string
channels
Channel[]
translations
Array<Translation<ShippingMethod>>
customFields
CustomShippingMethodFields
apply
(ctx: RequestContext, order: Order) => Promise<ShippingCalculationResult | undefined>
test
(ctx: RequestContext, order: Order) => Promise<boolean>