---
title: "line_item"

doc_type: static
doc_category: static
doc_version: v20260901
source_url:
  html: 'https://developer.shopline.com/docs/handlebars/objects/line-item'
  md: 'https://developer.shopline.com/docs/handlebars/objects/line-item.md'
---


# line_item

<div className="code-flex">
  <div>
    <ObjectSummary>
      A line in a cart, checkout, or order. Each line item represents a product variant.
    </ObjectSummary>
    #### Properties

    <ObjectProperty name="discount_allocations" types={[<Mdx>array of [discount_allocation](https://developer.shopline.com/docs/handlebars/objects/discount-allocation.md)</Mdx>]}>
      <ObjectSummary>
        The discount allocations that apply to the line item.
      </ObjectSummary>
    </ObjectProperty>

    <ObjectProperty name="final_line_price" types={["string"]}>
      <ObjectSummary>
        The combined price, 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`.
                > **Tip**
>
> Use [money helper](https://developer.shopline.com/docs/handlebars/helpers/money/money-with-currency.md) to output a formatted amount.
      </ObjectSummary>
    </ObjectProperty>

    <ObjectProperty name="final_price" types={["string"]}>
      <ObjectSummary>
        The price of the line item. This includes any line-level discounts.

                > **Tip**
>
> Use [money helper](https://developer.shopline.com/docs/handlebars/helpers/money/money-with-currency.md) to output a formatted amount.
      </ObjectSummary>
    </ObjectProperty>
    <ObjectProperty name="fulfillments" types={[<Mdx>array of fulfillment</Mdx>]}>
      <ObjectSummary>
        The fulfillment of the line item.
      </ObjectSummary>
    </ObjectProperty>

    <ObjectProperty name="gift_card" types={["boolean"]}>
      <ObjectSummary>
        Returns `true` if the product associated with the line item is a gift card. Returns `false` if not.
      </ObjectSummary>
    </ObjectProperty>

    {/* <ObjectProperty name="grams" types={["string"]}>
      <ObjectSummary>
        The weight of the line item in the store's [default weight unit]().
      </ObjectSummary>
    </ObjectProperty> */}

     {/* <ObjectProperty name="id" types={["number"]}>
      <ObjectSummary>
        The ID of the line item.
      </ObjectSummary>
    </ObjectProperty> */}

    <ObjectProperty name="image" types={[<Mdx>[image](https://developer.shopline.com/docs/handlebars/objects/image.md)</Mdx>]}>
      <ObjectSummary>
        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
      </ObjectSummary>
    </ObjectProperty>

    <ObjectProperty name="key" types={["string"]}>
      <ObjectSummary>
        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 the properties of the line item, even if there are no properties
      </ObjectSummary>
    </ObjectProperty>

    <ObjectProperty name="line_level_discount_allocations" types={[<Mdx>array of discount_allocations</Mdx>]}>
      <ObjectSummary>
        The discount allocations that apply directly to the line item.
      </ObjectSummary>
    </ObjectProperty>

    <ObjectProperty name="line_level_total_discount" types={["number"]}>
      <ObjectSummary>
        The total amount of any discounts applied to the line item.

                        > **Tip**
>
> Use [money helper](https://developer.shopline.com/docs/handlebars/helpers/money/money-with-currency.md) to output a formatted amount.
      </ObjectSummary>
    </ObjectProperty>

    <ObjectProperty name="options_with_values">
      <ObjectSummary>
        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.
      </ObjectSummary>
    </ObjectProperty>

    <ObjectProperty name="original_line_price" types={["string"]}>
      <ObjectSummary>
        The combined price of all of the items in a line item, before any discounts have been applied.

        The value is equal to `line_item.original_price` multiplied by `line_item.quantity`.

                        > **Tip**
>
> Use [money helper](https://developer.shopline.com/docs/handlebars/helpers/money/money-with-currency.md) to output a formatted amount.
      </ObjectSummary>
    </ObjectProperty>

    <ObjectProperty name="original_price" types={["string"]}>
      <ObjectSummary>
        The price of the line item, before discounts have been applied.

                        > **Tip**
>
> Use [money helper](https://developer.shopline.com/docs/handlebars/helpers/money/money-with-currency.md) to output a formatted amount.
      </ObjectSummary>
    </ObjectProperty>

    <ObjectProperty name="product" types={[<Mdx>[product](https://developer.shopline.com/docs/handlebars/objects/product.md)</Mdx>]}>
      <ObjectSummary>
        The product associated with the line item.
      </ObjectSummary>
    </ObjectProperty>

    <ObjectProperty name="product_id" types={["string"]}>
      <ObjectSummary>
        The [ID](https://developer.shopline.com/docs/handlebars/objects/product.md#id) of the line item's product.
      </ObjectSummary>
    </ObjectProperty>

    <ObjectProperty name="properties">
    {/* TODO 补充使用方法 */}
      <ObjectSummary>
        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
        - The AJAX Cart API
      </ObjectSummary>
    </ObjectProperty>

    <ObjectProperty name="quantity" types={["number"]}>
      <ObjectSummary>
        The quantity of the line item.
      </ObjectSummary>
    </ObjectProperty>

    <ObjectProperty name="requires_shipping" types={["boolean"]}>
      <ObjectSummary>
        Returns `true` if the variant associated with the line item requires shipping. Returns `false` if not.
      </ObjectSummary>
    </ObjectProperty>

    <ObjectProperty name="selling_plan_allocation" types={[<Mdx>selling_plan_allocation</Mdx>]}>
      {/* TODO 接口返回不是null 是属性每个undefined */}
      {/* TODO 补充可用性 */}
      <ObjectSummary>
        The selling plan allocation of the line item. If the line item doesn't have a selling plan allocation, then `null` is returned.
      </ObjectSummary>
    </ObjectProperty>

    <ObjectProperty name="sku" types={["string"]}>
      <ObjectSummary>
        The [sku](https://developer.shopline.com/docs/handlebars/objects/variant.md#sku) of the variant associated with the line item.
      </ObjectSummary>
    </ObjectProperty>

    <ObjectProperty name="successfully_fulfilled_quantity" types={["number"]}>
      <ObjectSummary>
        The number of items from the line item that have been successfully fulfilled.
      </ObjectSummary>
    </ObjectProperty>

    <ObjectProperty name="taxable" types={["boolean"]}>
      <ObjectSummary>
        Returns `true` if taxes should be charged on the line item. Returns `false` if not.
      </ObjectSummary>
    </ObjectProperty>

    {/* <ObjectProperty name="title" types={["string"]}>
      <ObjectSummary>
        The title of the line item. The title is a combination of `line_item.product.title` and `line_item.variant.title`, separated by a hyphen.
      </ObjectSummary>
    </ObjectProperty> */}

    <ObjectProperty name="url" types={["string"]}>
      <ObjectSummary>
        The relative URL of the variant associated with the line item.
      </ObjectSummary>
    </ObjectProperty>

    <ObjectProperty name="url_to_remove" types={["string"]}>
      <ObjectSummary>
        A URL to remove the line item from the cart.
        {/* TODO 补充最佳实践跳转 */}
      </ObjectSummary>
    </ObjectProperty>

    <ObjectProperty name="variant" types={["variant"]}>
      <ObjectSummary>
        The variant associated with the line item.
      </ObjectSummary>
    </ObjectProperty>

    <ObjectProperty name="variant_id" types={["string"]}>
      <ObjectSummary>
        The [ID](https://developer.shopline.com/docs/handlebars/objects/variant.md#id) of the line item's variant.
      </ObjectSummary>
    </ObjectProperty>

    <ObjectProperty name="vendor" types={["string"]}>
      <ObjectSummary>
        The vendor of the variant associated with the line item.
      </ObjectSummary>
    </ObjectProperty>
  </div>

  <div>
    <ObjectAccess
      object="line_item"
      global={false}
      parents={[
        { object: 'cart.items', link: '/docsv2/ec20/hdwvcvrgnfcjf4gq/rmhen6uapsz6pyu4#items' },
        { object: 'checkout.line_items', link: '/docsv2/ec20/hdwvcvrgnfcjf4gq/8ufgwg6esxkwtg35#line_items' },
      ]}
    />
  </div>
</div>
