Interface LineItem
- All Superinterfaces:
- Customizable<LineItem>
The representation of a Line Item in a Cart or in an Order.
Example to create an instance using the builder pattern
     LineItem lineItem = LineItem.builder()
             .id("{id}")
             .productId("{productId}")
             .name(nameBuilder -> nameBuilder)
             .productType(productTypeBuilder -> productTypeBuilder)
             .variant(variantBuilder -> variantBuilder)
             .price(priceBuilder -> priceBuilder)
             .quantity(0.3)
             .totalPrice(totalPriceBuilder -> totalPriceBuilder)
             .plusDiscountedPricePerQuantity(discountedPricePerQuantityBuilder -> discountedPricePerQuantityBuilder)
             .plusTaxedPricePortions(taxedPricePortionsBuilder -> taxedPricePortionsBuilder)
             .plusState(stateBuilder -> stateBuilder)
             .plusPerMethodTaxRate(perMethodTaxRateBuilder -> perMethodTaxRateBuilder)
             .priceMode(LineItemPriceMode.PLATFORM)
             .lineItemMode(LineItemMode.STANDARD)
             .build()
 - 
Method SummaryModifier and TypeMethodDescriptionstatic LineItemBuilderbuilder()builder factory method for LineItemstatic LineItemBuildercreate builder for LineItem instancecopyDeep()static LineItemfactory method to create a deep copy of LineItemDate and time (UTC) the Line Item was added to the Cart.@Valid CustomFieldsCustom Fields of the Line Item.@NotNull @Valid List<DiscountedLineItemPriceForQuantity>Discounted price of a single quantity of the Line Item.@Valid ChannelReferenceUsed to select a Product Price.@NotNull StringgetId()Unique identifier of the LineItem.Inventory mode specific to this Line Item only, and valid for the entirequantityof the Line Item.getKey()User-defined unique identifier of the LineItem.Date and time (UTC) the Line Item was last updated.@NotNull LineItemModeIndicates how the Line Item is added to the Cart.@NotNull @Valid LocalizedStringgetName()Name of the Product.@NotNull @Valid List<MethodTaxRate>Tax Rate per Shipping Method for a Cart withMultipleShippingMode.@NotNull @Valid PricegetPrice()Price of a Line Item selected from the Product Variant according to the ProductpriceMode.@NotNull LineItemPriceModeIndicates how the Price for the Line Item is set.@NotNull Stringidof the Product the Line Item is based on.keyof the Product.@Valid LocalizedStringslugof the current version of the Product.@NotNull @Valid ProductTypeReferenceProduct Type of the Product.@NotNull Long@Valid LineItemRecurrenceInfoRecurring Order and frequency data.@Valid ItemShippingDetailsContainer for Line Item-specific addresses.getState()Tracks specific quantities of the Line Item within a given State.@Valid ChannelReferenceIdentifies Inventory entries that are reserved.@Valid TaxedItemPriceAutomatically set aftertaxRateis set.@NotNull @Valid List<MethodTaxedPrice>Total taxed prices based on the quantity of Line Item assigned to each Shipping Method.@Valid TaxRateFor a Cart withPlatformTaxMode, thetaxRateof Line Items is set automatically once a shipping address is set.@NotNull @Valid CentPrecisionMoneyTotal price of this Line Item equallingpricemultiplied byquantity.@NotNull @Valid ProductVariantHolds the data of the Product Variant added to the Cart.static LineItemof()factory methodstatic LineItemfactory method to create a shallow copy LineItemvoidsetAddedAt(ZonedDateTime addedAt) Date and time (UTC) the Line Item was added to the Cart.voidsetCustom(CustomFields custom) Custom Fields of the Line Item.voidsetDiscountedPricePerQuantity(DiscountedLineItemPriceForQuantity... discountedPricePerQuantity) Discounted price of a single quantity of the Line Item.voidsetDiscountedPricePerQuantity(List<DiscountedLineItemPriceForQuantity> discountedPricePerQuantity) Discounted price of a single quantity of the Line Item.voidsetDistributionChannel(ChannelReference distributionChannel) Used to select a Product Price.voidUnique identifier of the LineItem.voidsetInventoryMode(InventoryMode inventoryMode) Inventory mode specific to this Line Item only, and valid for the entirequantityof the Line Item.voidUser-defined unique identifier of the LineItem.voidsetLastModifiedAt(ZonedDateTime lastModifiedAt) Date and time (UTC) the Line Item was last updated.voidsetLineItemMode(LineItemMode lineItemMode) Indicates how the Line Item is added to the Cart.voidsetName(LocalizedString name) Name of the Product.voidsetPerMethodTaxRate(MethodTaxRate... perMethodTaxRate) Tax Rate per Shipping Method for a Cart withMultipleShippingMode.voidsetPerMethodTaxRate(List<MethodTaxRate> perMethodTaxRate) Tax Rate per Shipping Method for a Cart withMultipleShippingMode.voidPrice of a Line Item selected from the Product Variant according to the ProductpriceMode.voidsetPriceMode(LineItemPriceMode priceMode) Indicates how the Price for the Line Item is set.voidsetProductId(String productId) idof the Product the Line Item is based on.voidsetProductKey(String productKey) keyof the Product.voidsetProductSlug(LocalizedString productSlug) slugof the current version of the Product.voidsetProductType(ProductTypeReference productType) Product Type of the Product.voidsetQuantity(Long quantity) voidsetRecurrenceInfo(LineItemRecurrenceInfo recurrenceInfo) Recurring Order and frequency data.voidsetShippingDetails(ItemShippingDetails shippingDetails) Container for Line Item-specific addresses.voidTracks specific quantities of the Line Item within a given State.voidTracks specific quantities of the Line Item within a given State.voidsetSupplyChannel(ChannelReference supplyChannel) Identifies Inventory entries that are reserved.voidsetTaxedPrice(TaxedItemPrice taxedPrice) Automatically set aftertaxRateis set.voidsetTaxedPricePortions(MethodTaxedPrice... taxedPricePortions) Total taxed prices based on the quantity of Line Item assigned to each Shipping Method.voidsetTaxedPricePortions(List<MethodTaxedPrice> taxedPricePortions) Total taxed prices based on the quantity of Line Item assigned to each Shipping Method.voidsetTaxRate(TaxRate taxRate) For a Cart withPlatformTaxMode, thetaxRateof Line Items is set automatically once a shipping address is set.voidsetTotalPrice(CentPrecisionMoney totalPrice) Total price of this Line Item equallingpricemultiplied byquantity.voidsetVariant(ProductVariant variant) Holds the data of the Product Variant added to the Cart.static com.fasterxml.jackson.core.type.TypeReference<LineItem>gives a TypeReference for usage with Jackson DataBinddefault <T> TwithLineItem(Function<LineItem, T> helper) accessor map functionMethods inherited from interface com.commercetools.api.models.CustomizableunwrapCustomizable
- 
Method Details- 
getIdUnique identifier of the LineItem. - Returns:
- id
 
- 
getKeyString getKey()User-defined unique identifier of the LineItem. - Returns:
- key
 
- 
getProductIdidof the Product the Line Item is based on.- Returns:
- productId
 
- 
getProductKeyString getProductKey()keyof the Product.This field is only present on: - Line Items in a Cart when the keyis available on that specific Product at the time the LineItem was created or updated on the Cart.
- Line Items in an Order when the keyis available on the specific Product at the time the Order was created from the Cart.
 Present on resources created or updated after 3 December 2021. - Returns:
- productKey
 
- Line Items in a Cart when the 
- 
getNameName of the Product. - Returns:
- name
 
- 
getProductSlugslugof the current version of the Product. Updated automatically if theslugchanges. Empty if the Product has been deleted. TheproductSlugfield of LineItem is not expanded when using Reference Expansion.- Returns:
- productSlug
 
- 
getProductTypeProduct Type of the Product. - Returns:
- productType
 
- 
getVariantHolds the data of the Product Variant added to the Cart. The data is saved at the time the Product Variant is added to the Cart and is not updated automatically when Product Variant data changes. Must be updated using the Recalculate update action. - Returns:
- variant
 
- 
getPricePrice of a Line Item selected from the Product Variant according to the Product priceMode. If thepriceModeisEmbeddedProductPriceMode and thevariantfield hasn't been updated, the price may not correspond to a price invariant.prices.- Returns:
- price
 
- 
getQuantity- Returns:
- quantity
 
- 
getTotalPriceTotal price of this Line Item equalling pricemultiplied byquantity. If the Line Item is discounted, the total price is thediscountedPricePerQuantitymultiplied byquantity. Includes taxes if the TaxRateincludedInPriceistrue.If ExternalPriceLineItemPriceMode is used with high-precision money, then the total price is rounded by using theHalfEvenrounding mode.- Returns:
- totalPrice
 
- 
getDiscountedPricePerQuantity@NotNull @Valid @NotNull @Valid List<DiscountedLineItemPriceForQuantity> getDiscountedPricePerQuantity()Discounted price of a single quantity of the Line Item. - Returns:
- discountedPricePerQuantity
 
- 
getTaxedPriceAutomatically set after taxRateis set.- Returns:
- taxedPrice
 
- 
getTaxedPricePortionsTotal taxed prices based on the quantity of Line Item assigned to each Shipping Method. Only applicable for Carts with MultipleShippingMode. Automatically set afterperMethodTaxRateis set.- Returns:
- taxedPricePortions
 
- 
getStateTracks specific quantities of the Line Item within a given State. When a Line Item is added to a Cart, its full quantity is set to the built-in "Initial" state. State transitions for Line Items are managed on the Order. - Returns:
- state
 
- 
getTaxRate- For a Cart with PlatformTaxMode, thetaxRateof Line Items is set automatically once a shipping address is set. The rate is based on the TaxCategory that applies for the shipping address.
- For a Cart with ExternalTaxMode, thetaxRateof Line Items can be set using ExternalTaxRateDraft.
 - Returns:
- taxRate
 
- For a Cart with 
- 
getPerMethodTaxRateTax Rate per Shipping Method for a Cart with MultipleShippingMode. For a Cart withPlatformTaxMode it is automatically set after the Shipping Method is added. For a Cart withExternalTaxMode, the Tax Rate must be set with ExternalTaxRateDraft.- Returns:
- perMethodTaxRate
 
- 
getSupplyChannelIdentifies Inventory entries that are reserved. The referenced Channel has the InventorySupplyChannelRoleEnum.- Returns:
- supplyChannel
 
- 
getDistributionChannelUsed to select a Product Price. The referenced Channel has the ProductDistributionChannelRoleEnum.- Returns:
- distributionChannel
 
- 
getPriceModeIndicates how the Price for the Line Item is set. - Returns:
- priceMode
 
- 
getLineItemModeIndicates how the Line Item is added to the Cart. - Returns:
- lineItemMode
 
- 
getInventoryModeInventoryMode getInventoryMode()Inventory mode specific to this Line Item only, and valid for the entire quantityof the Line Item. Only present if the inventory mode is different from theinventoryModespecified on the Cart.- Returns:
- inventoryMode
 
- 
getShippingDetailsContainer for Line Item-specific addresses. - Returns:
- shippingDetails
 
- 
getCustomCustom Fields of the Line Item. - Specified by:
- getCustomin interface- Customizable<LineItem>
- Returns:
- custom
 
- 
getAddedAtZonedDateTime getAddedAt()Date and time (UTC) the Line Item was added to the Cart. - Returns:
- addedAt
 
- 
getLastModifiedAtZonedDateTime getLastModifiedAt()Date and time (UTC) the Line Item was last updated. - Returns:
- lastModifiedAt
 
- 
getRecurrenceInfoRecurring Order and frequency data. - Returns:
- recurrenceInfo
 
- 
setIdUnique identifier of the LineItem. - Parameters:
- id- value to be set
 
- 
setKeyUser-defined unique identifier of the LineItem. - Parameters:
- key- value to be set
 
- 
setProductIdidof the Product the Line Item is based on.- Parameters:
- productId- value to be set
 
- 
setProductKeykeyof the Product.This field is only present on: - Line Items in a Cart when the keyis available on that specific Product at the time the LineItem was created or updated on the Cart.
- Line Items in an Order when the keyis available on the specific Product at the time the Order was created from the Cart.
 Present on resources created or updated after 3 December 2021. - Parameters:
- productKey- value to be set
 
- Line Items in a Cart when the 
- 
setNameName of the Product. - Parameters:
- name- value to be set
 
- 
setProductSlugslugof the current version of the Product. Updated automatically if theslugchanges. Empty if the Product has been deleted. TheproductSlugfield of LineItem is not expanded when using Reference Expansion.- Parameters:
- productSlug- value to be set
 
- 
setProductTypeProduct Type of the Product. - Parameters:
- productType- value to be set
 
- 
setVariantHolds the data of the Product Variant added to the Cart. The data is saved at the time the Product Variant is added to the Cart and is not updated automatically when Product Variant data changes. Must be updated using the Recalculate update action. - Parameters:
- variant- value to be set
 
- 
setPricePrice of a Line Item selected from the Product Variant according to the Product priceMode. If thepriceModeisEmbeddedProductPriceMode and thevariantfield hasn't been updated, the price may not correspond to a price invariant.prices.- Parameters:
- price- value to be set
 
- 
setQuantity- Parameters:
- quantity- value to be set
 
- 
setTotalPriceTotal price of this Line Item equalling pricemultiplied byquantity. If the Line Item is discounted, the total price is thediscountedPricePerQuantitymultiplied byquantity. Includes taxes if the TaxRateincludedInPriceistrue.If ExternalPriceLineItemPriceMode is used with high-precision money, then the total price is rounded by using theHalfEvenrounding mode.- Parameters:
- totalPrice- value to be set
 
- 
setDiscountedPricePerQuantityvoid setDiscountedPricePerQuantity(DiscountedLineItemPriceForQuantity... discountedPricePerQuantity) Discounted price of a single quantity of the Line Item. - Parameters:
- discountedPricePerQuantity- values to be set
 
- 
setDiscountedPricePerQuantityvoid setDiscountedPricePerQuantity(List<DiscountedLineItemPriceForQuantity> discountedPricePerQuantity) Discounted price of a single quantity of the Line Item. - Parameters:
- discountedPricePerQuantity- values to be set
 
- 
setTaxedPriceAutomatically set after taxRateis set.- Parameters:
- taxedPrice- value to be set
 
- 
setTaxedPricePortionsTotal taxed prices based on the quantity of Line Item assigned to each Shipping Method. Only applicable for Carts with MultipleShippingMode. Automatically set afterperMethodTaxRateis set.- Parameters:
- taxedPricePortions- values to be set
 
- 
setTaxedPricePortionsTotal taxed prices based on the quantity of Line Item assigned to each Shipping Method. Only applicable for Carts with MultipleShippingMode. Automatically set afterperMethodTaxRateis set.- Parameters:
- taxedPricePortions- values to be set
 
- 
setStateTracks specific quantities of the Line Item within a given State. When a Line Item is added to a Cart, its full quantity is set to the built-in "Initial" state. State transitions for Line Items are managed on the Order. - Parameters:
- state- values to be set
 
- 
setStateTracks specific quantities of the Line Item within a given State. When a Line Item is added to a Cart, its full quantity is set to the built-in "Initial" state. State transitions for Line Items are managed on the Order. - Parameters:
- state- values to be set
 
- 
setTaxRate- For a Cart with PlatformTaxMode, thetaxRateof Line Items is set automatically once a shipping address is set. The rate is based on the TaxCategory that applies for the shipping address.
- For a Cart with ExternalTaxMode, thetaxRateof Line Items can be set using ExternalTaxRateDraft.
 - Parameters:
- taxRate- value to be set
 
- For a Cart with 
- 
setPerMethodTaxRateTax Rate per Shipping Method for a Cart with MultipleShippingMode. For a Cart withPlatformTaxMode it is automatically set after the Shipping Method is added. For a Cart withExternalTaxMode, the Tax Rate must be set with ExternalTaxRateDraft.- Parameters:
- perMethodTaxRate- values to be set
 
- 
setPerMethodTaxRateTax Rate per Shipping Method for a Cart with MultipleShippingMode. For a Cart withPlatformTaxMode it is automatically set after the Shipping Method is added. For a Cart withExternalTaxMode, the Tax Rate must be set with ExternalTaxRateDraft.- Parameters:
- perMethodTaxRate- values to be set
 
- 
setSupplyChannelIdentifies Inventory entries that are reserved. The referenced Channel has the InventorySupplyChannelRoleEnum.- Parameters:
- supplyChannel- value to be set
 
- 
setDistributionChannelUsed to select a Product Price. The referenced Channel has the ProductDistributionChannelRoleEnum.- Parameters:
- distributionChannel- value to be set
 
- 
setPriceModeIndicates how the Price for the Line Item is set. - Parameters:
- priceMode- value to be set
 
- 
setLineItemModeIndicates how the Line Item is added to the Cart. - Parameters:
- lineItemMode- value to be set
 
- 
setInventoryModeInventory mode specific to this Line Item only, and valid for the entire quantityof the Line Item. Only present if the inventory mode is different from theinventoryModespecified on the Cart.- Parameters:
- inventoryMode- value to be set
 
- 
setShippingDetailsContainer for Line Item-specific addresses. - Parameters:
- shippingDetails- value to be set
 
- 
setCustomCustom Fields of the Line Item. - Specified by:
- setCustomin interface- Customizable<LineItem>
- Parameters:
- custom- value to be set
 
- 
setAddedAtDate and time (UTC) the Line Item was added to the Cart. - Parameters:
- addedAt- value to be set
 
- 
setLastModifiedAtDate and time (UTC) the Line Item was last updated. - Parameters:
- lastModifiedAt- value to be set
 
- 
setRecurrenceInfoRecurring Order and frequency data. - Parameters:
- recurrenceInfo- value to be set
 
- 
offactory method- Returns:
- instance of LineItem
 
- 
offactory method to create a shallow copy LineItem- Parameters:
- template- instance to be copied
- Returns:
- copy instance
 
- 
copyDeepLineItem copyDeep()
- 
deepCopyfactory method to create a deep copy of LineItem- Parameters:
- template- instance to be copied
- Returns:
- copy instance
 
- 
builderbuilder factory method for LineItem- Returns:
- builder
 
- 
buildercreate builder for LineItem instance- Parameters:
- template- instance with prefilled values for the builder
- Returns:
- builder
 
- 
withLineItemaccessor map function- Type Parameters:
- T- mapped type
- Parameters:
- helper- function to map the object
- Returns:
- mapped value
 
- 
typeReferencegives a TypeReference for usage with Jackson DataBind- Returns:
- TypeReference
 
 
-