🚨 Announcing Vendure v2 Beta

OrderItem

OrderItem

An individual item of an OrderLine.

Signature

class OrderItem extends VendureEntity {
  constructor(input?: DeepPartial<OrderItem>)
  @ManyToOne(type => OrderLine, line => line.items, { onDelete: 'CASCADE' })
    line: OrderLine;
  @EntityId()
    lineId: ID;
  @Column({ nullable: true })
    initialListPrice: number;
  @Column()
    listPrice: number;
  @Column()
    listPriceIncludesTax: boolean;
  @Column('simple-json')
    adjustments: Adjustment[];
  @Column('simple-json')
    taxLines: TaxLine[];
  @ManyToMany(type => Fulfillment, fulfillment => fulfillment.orderItems)
    @JoinTable()
    fulfillments: Fulfillment[];
  @ManyToOne(type => Refund)
    refund: Refund;
  @EntityId({ nullable: true })
    refundId: ID | null;
  @OneToOne(type => Cancellation, cancellation => cancellation.orderItem)
    cancellation: Cancellation;
  @Column({ default: false })
    cancelled: boolean;
  fulfillment: Fulfillment | undefined
  unitPrice: number
  unitPriceWithTax: number
  taxRate: number
  unitTax: number
  discountedUnitPrice: number
  discountedUnitPriceWithTax: number
  proratedUnitPrice: number
  proratedUnitPriceWithTax: number
  proratedUnitTax: number
  addAdjustment(adjustment: Adjustment) => ;
  clearAdjustments(type?: AdjustmentType) => ;
}

Extends

Members

constructor

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

line

property
type:
OrderLine

lineId

property
type:
ID

initialListPrice

property
type:
number
The price as calculated when the OrderItem was first added to the Order. Usually will be identical to the listPrice, except when the ProductVariant price has changed in the mean time and a re-calculation of the Order has been performed.

listPrice

property
type:
number
This is the price as listed by the ProductVariant (and possibly modified by the OrderItemPriceCalculationStrategy), which, depending on the current Channel, may or may not include tax.

listPriceIncludesTax

property
type:
boolean
Whether or not the listPrice includes tax, which depends on the settings of the current Channel.

adjustments

property
type:
Adjustment[]

taxLines

property
type:
TaxLine[]

fulfillments

property
type:
Fulfillment[]

refund

property
type:
Refund

refundId

property
type:
ID | null

cancellation

property
type:
Cancellation

cancelled

property
type:
boolean

fulfillment

property
type:
Fulfillment | undefined

unitPrice

property
type:
number
The price of a single unit, excluding tax and discounts.

unitPriceWithTax

property
type:
number
The price of a single unit, including tax but excluding discounts.

taxRate

property
type:
number
The total applicable tax rate, which is the sum of all taxLines on this OrderItem.

unitTax

property
type:
number

discountedUnitPrice

property
type:
number

The price of a single unit including discounts, excluding tax.

If Order-level discounts have been applied, this will not be the actual taxable unit price (see proratedUnitPrice), but is generally the correct price to display to customers to avoid confusion about the internal handling of distributed Order-level discounts.

discountedUnitPriceWithTax

property
type:
number
The price of a single unit including discounts and tax.

proratedUnitPrice

property
type:
number
The actual unit price, taking into account both item discounts and prorated (proportionally-distributed) Order-level discounts. This value is the true economic value of the OrderItem, and is used in tax and refund calculations.

proratedUnitPriceWithTax

property
type:
number
The proratedUnitPrice including tax.

proratedUnitTax

property
type:
number

addAdjustment

method
type:
(adjustment: Adjustment) =>

clearAdjustments

method
type:
(type?: AdjustmentType) =>