---
title: 'Liquid objects: line_item'
description: >-
A line in a cart, checkout, or order. Each line item represents a product
variant.
api_name: liquid
source_url:
html: 'https://shopify.dev/docs/api/liquid/objects/line_item'
md: 'https://shopify.dev/docs/api/liquid/objects/line_item.md'
---
# line\_item
A line in a cart, checkout, or order. Each line item represents a product variant.
## Properties
* * discount\_allocations
array of [discount\_allocation](https://shopify.dev/docs/api/liquid/objects/discount_allocation)
* The discount allocations that apply to the line item.
Caution
Not applicable for item component as discounts are applied to the parent line item.
* error\_message
[string](https://shopify.dev/docs/api/liquid/basics#string)
* An informational error message about the status of the line item in the buyer's chosen language.
Note
This field is applicable for cart line item only and currently available for shops using Checkout Extensibility.
* final\_line\_price
[number](https://shopify.dev/docs/api/liquid/basics#number)
* The combined price, in the currency's subunit, of all of the items in the line item. This includes any line-level discounts.
The value is equal to `line_item.final_price` multiplied by `line_item.quantity`. It's output in the customer's local (presentment) currency.
For currencies without subunits, such as JPY and KRW, tenths and hundredths of a unit are appended. For example, 1000 Japanese yen is output as 100000.
Tip
Use [money filters](https://shopify.dev/docs/api/liquid/filters/money-filters) to output a formatted price.
* final\_price
[number](https://shopify.dev/docs/api/liquid/basics#number)
* The price of the line item in the currency's subunit. This includes any line-level discounts.
The value is output in the customer's local (presentment) currency.
For currencies without subunits, such as JPY and KRW, tenths and hundredths of a unit are appended. For example, 1000 Japanese yen is output as 100000.
Tip
Use [money filters](https://shopify.dev/docs/api/liquid/filters/money-filters) to output a formatted price.
* fulfillment
[fulfillment](https://shopify.dev/docs/api/liquid/objects/fulfillment)
* The fulfillment of the line item.
* fulfillment\_service
[string](https://shopify.dev/docs/api/liquid/basics#string)
* The [fulfillment service](https://help.shopify.com/manual/shipping/understanding-shipping/dropshipping-and-fulfillment-services) for the vartiant associated with the line item. If there's no fulfillment service, then `manual` is returned.
* gift\_card
[boolean](https://shopify.dev/docs/api/liquid/basics#boolean)
* Returns `true` if the product associated with the line item is a gift card. Returns `false` if not.
* grams
[number](https://shopify.dev/docs/api/liquid/basics#number)
* The weight of the line item in the store's [default weight unit](https://help.shopify.com/manual/intro-to-shopify/initial-setup/setup-business-settings#set-or-change-your-stores-default-weight-unit).
Tip
Use this property with the [`weight_with_unit` filter](https://shopify.dev/docs/api/liquid/filters/weight_with_unit) to format the weight.
* id
[number](https://shopify.dev/docs/api/liquid/basics#number)
* The ID of the line item.
The ID differs depending on the context. The following table outlines the possible contexts and their associated values:
| Context | Value |
| - | - |
| [`cart.items`](https://shopify.dev/docs/api/liquid/objects/cart#cart-items) | The ID of the line item's variant. This ID isn't unique, and can be shared by multiple items with the same variant. |
| [`checkout.line_items`](https://shopify.dev/docs/api/liquid/objects/checkout#checkout-line_items) | A temporary unique hash generated for the checkout. |
| [`order.line_items`](https://shopify.dev/docs/api/liquid/objects/order#order-line_items) | A unique integer ID. |
* image
[image](https://shopify.dev/docs/api/liquid/objects/image)
* The image of the line item.
The image can come from one of the following sources:
* The image of the variant associated with the line item
* The featured image of the product associated with the line item, if there's no variant image
* instructions
[instructions](https://shopify.dev/docs/api/liquid/objects/instructions)
* Instructions define behaviours and operations that can be performed on the nested cart line.
Note
This field is applicable for cart line item only.
* item\_components
array of [line\_item](https://shopify.dev/docs/api/liquid/objects/line_item)
* The components of a line item.
Note
This field is applicable for cart line item only.
* key
[string](https://shopify.dev/docs/api/liquid/basics#string)
* The key of the line item.
Line item keys are unique identifiers that consist of the following components separated by a colon:
* The ID of the variant associated with the line item
* A hash of unique characteristics of the line item.
Note: Line item keys are not stable identifiers. The line item key will change as characteristics of the line item change. This includes, but is not limited to, properties and discount applications.
* line\_level\_discount\_allocations
array of [discount\_allocation](https://shopify.dev/docs/api/liquid/objects/discount_allocation)
* The discount allocations that apply directly to the line item.
Caution
Not applicable for item component as discounts are applied to the parent line item.
* line\_level\_total\_discount
[number](https://shopify.dev/docs/api/liquid/basics#number)
* The total amount of any discounts applied to the line item in the currency's subunit.
The value is output in the customer's local (presentment) currency.
For currencies without subunits, such as JPY and KRW, tenths and hundredths of a unit are appended. For example, 1000 Japanese yen is output as 100000.
Tip
Use [money filters](https://shopify.dev/docs/api/liquid/filters/money-filters) to output a formatted amount.
* message
[string](https://shopify.dev/docs/api/liquid/basics#string)
* Information about the discounts that have affected the line item.
The following table outlines what's returned depending on the number of discounts affecting the line item:
| Number of discounts | Value |
| - | - |
| 0 | `nil` |
| 1 | The [title](https://shopify.dev/docs/api/liquid/objects/discount_application#discount_application-title) of the discount. |
| More than 1 | A Shopify generated string noting how many discounts have been applied. |
* options\_with\_values
* The name and value pairs for each option of the variant associated with the line item.
Note
The array is never empty because variants with no options still have a default option. Because of this, you should use `line_item.product.has_only_default_variant` to check whether there's any information to output.
ExampleOutput the option values
```liquid
{% for item in cart.items %}
```
* original\_line\_price
[number](https://shopify.dev/docs/api/liquid/basics#number)
* The combined price of all of the items in a line item in the currency's subunit, before any discounts have been applied.
The value is equal to `line_item.original_price` multiplied by `line_item.quantity`. It's output in the customer's local (presentment) currency.
For currencies without subunits, such as JPY and KRW, tenths and hundredths of a unit are appended. For example, 1000 Japanese yen is output as 100000.
Tip
Use [money filters](https://shopify.dev/docs/api/liquid/filters/money-filters) to output a formatted price.
* original\_price
[number](https://shopify.dev/docs/api/liquid/basics#number)
* The price of the line item in the currency's subunit, before discounts have been applied.
The value is output in the customer's local (presentment) currency.
For currencies without subunits, such as JPY and KRW, tenths and hundredths of a unit are appended. For example, 1000 Japanese yen is output as 100000.
Tip
Use [money filters](https://shopify.dev/docs/api/liquid/filters/money-filters) to output a formatted price.
* parent\_relationship
[parent\_relationship](https://shopify.dev/docs/api/liquid/objects/parent_relationship)
* The parent relationship for a nested line item.
Note
This field is applicable for cart line item only.
* product
[product](https://shopify.dev/docs/api/liquid/objects/product)
* The product associated with the line item. May be a regular [product](https://shopify.dev/docs/api/liquid/objects/product) or a [remote product](https://shopify.dev/docs/api/liquid/objects/remote_product).
* product\_id
[number](https://shopify.dev/docs/api/liquid/basics#number)
* The [ID](https://shopify.dev/docs/api/liquid/objects/product#product-id) of the line item's product.
* properties
* The properties of the line item.
You can add, or allow customers to add, custom information to a line item with line item properties.
Line item properties consist of a name and value pair. They can be captured with the following methods:
* [A custom input inside a product form](https://shopify.dev/themes/architecture/templates/product#line-item-properties)
* [The AJAX Cart API](https://shopify.dev/api/ajax/reference/cart#add-line-item-properties)
Tip
To learn about how to display captured properties, refer to [Display line item properties](https://shopify.dev/themes/architecture/templates/cart#display-line-item-properties).
ExampleCapture line item properties in the product form
To capture line item properties inside the [product form](https://shopify.dev/docs/api/liquid/tags/form#form-product), you need to include an input, for each property. Each input needs a unique `name` attribute. Use the following format:
```
name="properties[property-name]"
```
The value of the input is captured as the value of the property.
For example, you can use the following code to capture custom engraving text for a product:
```liquid
{% form 'product', product %}
...