OrderLine

OrderLine

A single line on an Order which contains information about the ProductVariant and quantity ordered, as well as the price and tax information.

Signature

class OrderLine extends VendureEntity implements HasCustomFields {
  constructor(input?: DeepPartial<OrderLine>)
  @Index() @ManyToOne(type => Channel, { nullable: true, onDelete: 'SET NULL' }) @Index()
    @ManyToOne(type => Channel, { nullable: true, onDelete: 'SET NULL' })
    sellerChannel?: Channel;
  @EntityId({ nullable: true }) @EntityId({ nullable: true })
    sellerChannelId?: ID;
  @Index() @ManyToOne(type => ShippingLine, { nullable: true, onDelete: 'SET NULL' }) @Index()
    @ManyToOne(type => ShippingLine, { nullable: true, onDelete: 'SET NULL' })
    shippingLine?: ShippingLine;
  @EntityId({ nullable: true }) @EntityId({ nullable: true })
    shippingLineId?: ID;
  @Index() @ManyToOne(type => ProductVariant) @Index()
    @ManyToOne(type => ProductVariant)
    productVariant: ProductVariant;
  @EntityId() @EntityId()
    productVariantId: ID;
  @Index() @ManyToOne(type => TaxCategory) @Index()
    @ManyToOne(type => TaxCategory)
    taxCategory: TaxCategory;
  @Index() @ManyToOne(type => Asset) @Index()
    @ManyToOne(type => Asset)
    featuredAsset: Asset;
  @Index() @ManyToOne(type => Order, order => order.lines, { onDelete: 'CASCADE' }) @Index()
    @ManyToOne(type => Order, order => order.lines, { onDelete: 'CASCADE' })
    order: Order;
  @Column() @Column()
    quantity: number;
  @Column({ default: 0 }) @Column({ default: 0 })
    orderPlacedQuantity: number;
  @Money({ nullable: true }) @Money({ nullable: true })
    initialListPrice: number;
  @Money() @Money()
    listPrice: number;
  @Column() @Column()
    listPriceIncludesTax: boolean;
  @Column('simple-json') @Column('simple-json')
    adjustments: Adjustment[];
  @Column('simple-json') @Column('simple-json')
    taxLines: TaxLine[];
  @OneToOne(type => Cancellation, cancellation => cancellation.orderLine) @OneToOne(type => Cancellation, cancellation => cancellation.orderLine)
    cancellation: Cancellation;
  @Column(type => CustomOrderLineFields) @Column(type => CustomOrderLineFields)
    customFields: CustomOrderLineFields;
  @Calculated() unitPrice: number
  @Calculated() unitPriceWithTax: number
  @Calculated() unitPriceChangeSinceAdded: number
  @Calculated() unitPriceWithTaxChangeSinceAdded: number
  @Calculated() discountedUnitPrice: number
  @Calculated() discountedUnitPriceWithTax: number
  @Calculated() proratedUnitPrice: number
  @Calculated() proratedUnitPriceWithTax: number
  @Calculated() unitTax: number
  @Calculated() proratedUnitTax: number
  @Calculated() taxRate: number
  @Calculated() linePrice: number
  @Calculated() linePriceWithTax: number
  @Calculated() discountedLinePrice: number
  @Calculated() discountedLinePriceWithTax: number
  @Calculated() discounts: Discount[]
  @Calculated() lineTax: number
  @Calculated() proratedLinePrice: number
  @Calculated() proratedLinePriceWithTax: number
  @Calculated() proratedLineTax: number
  addAdjustment(adjustment: Adjustment) => ;
  clearAdjustments(type?: AdjustmentType) => ;
}

Extends

Implements

  • HasCustomFields

Members

constructor

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

sellerChannel

property
type:
Channel
The Channel of the Seller for a multivendor setup.

sellerChannelId

property
type:
ID

shippingLine

property
type:
ShippingLine
The ShippingLine to which this line has been assigned. This is determined by the configured ShippingLineAssignmentStrategy.

shippingLineId

property
type:
ID

productVariant

property
The ProductVariant which is being ordered.

productVariantId

property
type:
ID

taxCategory

property
type:
TaxCategory

featuredAsset

property
type:
Asset

order

property
type:
Order

quantity

property
type:
number

orderPlacedQuantity

property
type:
number
The quantity of this OrderLine at the time the order was placed (as per the OrderPlacedStrategy).

initialListPrice

property
type:
number
The price as calculated when the OrderLine was first added to the Order. Usually will be identical to the listPrice, except when the ProductVariant price has changed in the meantime 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 the listPrice includes tax, which depends on the settings of the current Channel.

adjustments

property
type:
Adjustment[]

taxLines

property
type:
TaxLine[]

cancellation

property
type:
Cancellation

customFields

property
type:
CustomOrderLineFields

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.

unitPriceChangeSinceAdded

property
type:
number
Non-zero if the unitPrice has changed since it was initially added to Order.

unitPriceWithTaxChangeSinceAdded

property
type:
number
Non-zero if the unitPriceWithTax has changed since it was initially added to Order.

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 a single unit in this OrderLine, and is used in tax and refund calculations.

proratedUnitPriceWithTax

property
type:
number
The proratedUnitPrice including tax.

unitTax

property
type:
number

proratedUnitTax

property
type:
number

taxRate

property
type:
number

linePrice

property
type:
number
The total price of the line excluding tax and discounts.

linePriceWithTax

property
type:
number
The total price of the line including tax but excluding discounts.

discountedLinePrice

property
type:
number
The price of the line including discounts, excluding tax.

discountedLinePriceWithTax

property
type:
number
The price of the line including discounts and tax.

discounts

property
type:
Discount[]

lineTax

property
type:
number
The total tax on this line.

proratedLinePrice

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

proratedLinePriceWithTax

property
type:
number
The proratedLinePrice including tax.

proratedLineTax

property
type:
number

addAdjustment

method
type:
(adjustment: Adjustment) =>

clearAdjustments

method
type:
(type?: AdjustmentType) =>