Order
Order
An Order is created whenever a Customer adds an item to the cart. It contains all the information required to fulfill an order: which ProductVariants in what quantities; the shipping address and price; any applicable promotions; payments etc.
An Order exists in a well-defined state according to the OrderState type. A state machine is used to govern the transition from one state to another.
Signature
class Order extends VendureEntity implements ChannelAware, HasCustomFields {
constructor(input?: DeepPartial<Order>)
@Column() code: string;
@Column('varchar') state: OrderState;
@Column({ default: true })
active: boolean;
@Column({ nullable: true })
orderPlacedAt?: Date;
@ManyToOne(type => Customer)
customer?: Customer;
@OneToMany(type => OrderLine, line => line.order)
lines: OrderLine[];
@OneToMany(type => Surcharge, surcharge => surcharge.order)
surcharges: Surcharge[];
@Column('simple-array')
couponCodes: string[];
@ManyToMany(type => Promotion)
@JoinTable()
promotions: Promotion[];
@Column('simple-json') shippingAddress: OrderAddress;
@Column('simple-json') billingAddress: OrderAddress;
@OneToMany(type => Payment, payment => payment.order)
payments: Payment[];
@Column('varchar')
currencyCode: CurrencyCode;
@Column(type => CustomOrderFields)
customFields: CustomOrderFields;
@EntityId({ nullable: true })
taxZoneId?: ID;
@ManyToMany(type => Channel)
@JoinTable()
channels: Channel[];
@OneToMany(type => OrderModification, modification => modification.order)
modifications: OrderModification[];
@Column()
subTotal: number;
@Column()
subTotalWithTax: number;
@OneToMany(type => ShippingLine, shippingLine => shippingLine.order)
shippingLines: ShippingLine[];
@Column({ default: 0 })
shipping: number;
@Column({ default: 0 })
shippingWithTax: number;
discounts: Adjustment[]
total: number
totalWithTax: number
totalQuantity: number
taxSummary: OrderTaxSummary[]
getOrderItems() => OrderItem[];
}
Extends
Implements
- ChannelAware
- HasCustomFields
Members
constructor
method
type:
(input?: DeepPartial<Order>) => Order
code
property
type:
string
state
property
type:
OrderState
active
property
type:
boolean
orderPlacedAt
property
type:
Date
customer
property
type:
Customer
lines
property
type:
OrderLine[]
surcharges
property
type:
Surcharge[]
couponCodes
property
type:
string[]
promotions
property
type:
Promotion[]
shippingAddress
property
type:
OrderAddress
billingAddress
property
type:
OrderAddress
payments
property
type:
Payment[]
currencyCode
property
type:
CurrencyCode
customFields
property
type:
CustomOrderFields
taxZoneId
property
type:
ID
channels
property
type:
Channel[]
modifications
property
type:
OrderModification[]
subTotal
property
type:
number
subTotalWithTax
property
type:
number
shippingLines
property
type:
ShippingLine[]
shipping
property
type:
number
shippingWithTax
property
type:
number
discounts
property
type:
Adjustment[]
total
property
type:
number
totalWithTax
property
type:
number
totalQuantity
property
type:
number
taxSummary
property
type:
OrderTaxSummary[]
getOrderItems
method
type:
() => OrderItem[]