Read-only line item for the shopping cart, holding the quantity, pricing and product details for one item being purchased. Instances are built from a ShoppingCartItemResource (the purchasable resource, eg a product) or, for promotional items such as discounts and gifts, from plain title/amount values. Cart and checkout templates iterate over these beans to render and total the items in the cart.
Properties
| Property | Returns | Description |
|---|---|---|
| discountAmount | BigDecimal | Discount amount applied to this line item, if any. A negative value reduces the grand total. |
| discountReason | String | Explanation of why a discount was applied, for display alongside the discount amount. |
| grandTotalAmount | BigDecimal | Cost of this line item after any discount is applied. Equal to the total amount when no discount has been set. |
| href | String | URL of the item's page. |
| itemId | Long | Database identifier of the underlying product item. |
| itemPage | ShoppingCartItemResource | The purchasable resource this line item was built from. |
| productLocations | List<ProductLocationBean> | Locations the underlying product is available in. |
| quantity | Integer | Number of units of this item being purchased. |
| selectedParameterOptions | Map<String,String> | Purchase option values selected by the customer for this item, for example variant or size choices, keyed by option name. |
| title | String | Display title of the item. |
| totalAmount | BigDecimal | Cost of this line item before any discount is applied, calculated as the unit purchase cost multiplied by the quantity. |
| unitCost | BigDecimal | Cost of a single unit of this item, before tax and before the quantity is applied. |
Methods
getTotalAmount() · getGrandTotalAmount() · getQuantity() · getItemPage() · getHref() · getSelectedParameterOptions() · getTitle() · getDiscountAmount() · getDiscountReason() · getItemId() · getUnitCost() · getProductLocations()
getTotalAmount()
Returns: BigDecimal
Cost of this line item before any discount is applied, calculated as the unit purchase cost multiplied by the quantity.
getGrandTotalAmount()
Returns: BigDecimal
Cost of this line item after any discount is applied. Equal to the total amount when no discount has been set.
getQuantity()
Returns: Integer
Number of units of this item being purchased.
getItemPage()
Returns: ShoppingCartItemResource
The purchasable resource this line item was built from.
getHref()
Returns: String
URL of the item's page.
getSelectedParameterOptions()
Returns: Map<String,String>
Purchase option values selected by the customer for this item, for example variant or size choices, keyed by option name.
getTitle()
Returns: String
Display title of the item.
getDiscountAmount()
Returns: BigDecimal
Discount amount applied to this line item, if any. A negative value reduces the grand total.
getDiscountReason()
Returns: String
Explanation of why a discount was applied, for display alongside the discount amount.
getItemId()
Returns: Long
Database identifier of the underlying product item.
getUnitCost()
Returns: BigDecimal
Cost of a single unit of this item, before tax and before the quantity is applied.
getProductLocations()
Returns: List<ProductLocationBean>
Locations the underlying product is available in.