Home
WooCommerce
Woocommerce Rest Api Line Item Structure
Woocommerce Rest Api Line Item Structure
A product line item within an order.
Type: object
Properties: 13
eCommerce Open Source Orders Products WordPress
LineItem is a JSON Structure definition published by WooCommerce, describing 13 properties. It conforms to the https://json-structure.org/meta/core/v0/# meta-schema.
Properties
id
name
product_id
variation_id
quantity
tax_class
subtotal
subtotal_tax
total
total_tax
sku
price
meta_data
Meta-schema: https://json-structure.org/meta/core/v0/#
JSON Structure
{
"$schema": "https://json-structure.org/meta/core/v0/#",
"$id": "https://raw.githubusercontent.com/api-evangelist/woocommerce/refs/heads/main/json-structure/woocommerce-rest-api-line-item-structure.json",
"name": "LineItem",
"description": "A product line item within an order.",
"type": "object",
"properties": {
"id": {
"type": "int32",
"description": "Line item unique identifier.",
"example": 1
},
"name": {
"type": "string",
"description": "Product name at time of purchase.",
"example": "Example Name"
},
"product_id": {
"type": "int32",
"description": "Product ID.",
"example": 1
},
"variation_id": {
"type": "int32",
"description": "Variation ID (0 if not a variation).",
"example": 1
},
"quantity": {
"type": "int32",
"description": "Quantity ordered.",
"example": 1
},
"tax_class": {
"type": "string",
"description": "Tax class used for this line item.",
"example": "string-value"
},
"subtotal": {
"type": "string",
"description": "Line subtotal (before discounts) as a decimal string.",
"example": "string-value"
},
"subtotal_tax": {
"type": "string",
"description": "Line subtotal tax as a decimal string.",
"example": "string-value"
},
"total": {
"type": "string",
"description": "Line total (after discounts) as a decimal string.",
"example": "string-value"
},
"total_tax": {
"type": "string",
"description": "Line total tax as a decimal string.",
"example": "string-value"
},
"sku": {
"type": "string",
"description": "Product SKU.",
"example": "string-value"
},
"price": {
"type": "double",
"description": "Product price at time of purchase.",
"example": 10.5
},
"meta_data": {
"type": "array",
"description": "Metadata for the line item (e.g. variation attributes).",
"items": {
"type": "object",
"description": "Custom metadata key-value entry.",
"properties": {
"id": {
"type": "int32",
"description": "Metadata unique identifier.",
"example": 1
},
"key": {
"type": "string",
"description": "Metadata key.",
"example": "string-value"
},
"value": {
"type": "string",
"description": "Metadata value.",
"example": "string-value"
}
}
},
"example": [
"string-value"
]
}
}
}