--- displayed_sidebar: servicesSidebar --- import ParameterTypes from "@site/src/components/ParameterTypes" # LineItem Line Items are created when a product is added to a Cart. When Line Items are purchased they will get copied to the resulting order, swap, or claim, and can eventually be referenced in Fulfillments and Returns. Line items may also be used for order edits. ## Constructors ### constructor `**new LineItem**()` Line Items are created when a product is added to a Cart. When Line Items are purchased they will get copied to the resulting order, swap, or claim, and can eventually be referenced in Fulfillments and Returns. Line items may also be used for order edits. ## Properties `", "description": "An optional key-value map with additional details", "optional": false, "defaultValue": "", "expandable": false, "children": [] }, { "name": "order", "type": "[Order](Order.mdx)", "description": "The details of the order that the line item may belongs to.", "optional": false, "defaultValue": "", "expandable": true, "children": [] }, { "name": "order_edit", "type": "``null`` \\| [OrderEdit](OrderEdit.mdx)", "description": "The details of the order edit.", "optional": true, "defaultValue": "", "expandable": true, "children": [] }, { "name": "order_edit_id", "type": "``null`` \\| `string`", "description": "The ID of the order edit that the item may belong to.", "optional": true, "defaultValue": "", "expandable": false, "children": [] }, { "name": "order_id", "type": "``null`` \\| `string`", "description": "The ID of the order that the line item may belongs to.", "optional": false, "defaultValue": "", "expandable": false, "children": [] }, { "name": "original_item_id", "type": "``null`` \\| `string`", "description": "The ID of the original line item. This is useful if the line item belongs to a resource that references an order, such as a return or an order edit.", "optional": true, "defaultValue": "", "expandable": false, "children": [] }, { "name": "original_tax_total", "type": "``null`` \\| `number`", "description": "The original tax total amount of the line item", "optional": true, "defaultValue": "", "expandable": false, "children": [] }, { "name": "original_total", "type": "``null`` \\| `number`", "description": "The original total amount of the line item", "optional": true, "defaultValue": "", "expandable": false, "children": [] }, { "name": "product_id", "type": "``null`` \\| `string`", "description": "", "optional": false, "defaultValue": "", "expandable": false, "children": [] }, { "name": "quantity", "type": "`number`", "description": "The quantity of the content in the Line Item.", "optional": false, "defaultValue": "", "expandable": false, "children": [] }, { "name": "raw_discount_total", "type": "``null`` \\| `number`", "description": "The total of discount of the line item", "optional": true, "defaultValue": "", "expandable": false, "children": [] }, { "name": "refundable", "type": "``null`` \\| `number`", "description": "The amount that can be refunded from the given Line Item. Takes taxes and discounts into consideration.", "optional": true, "defaultValue": "", "expandable": false, "children": [] }, { "name": "returned_quantity", "type": "``null`` \\| `number`", "description": "The quantity of the Line Item that has been returned.", "optional": false, "defaultValue": "", "expandable": false, "children": [] }, { "name": "shipped_quantity", "type": "``null`` \\| `number`", "description": "The quantity of the Line Item that has been shipped.", "optional": false, "defaultValue": "", "expandable": false, "children": [] }, { "name": "should_merge", "type": "`boolean`", "description": "Flag to indicate if new Line Items with the same variant should be merged or added as an additional Line Item.", "optional": false, "defaultValue": "true", "expandable": false, "children": [] }, { "name": "subtotal", "type": "``null`` \\| `number`", "description": "The subtotal of the line item", "optional": true, "defaultValue": "", "expandable": false, "children": [] }, { "name": "swap", "type": "[Swap](Swap.mdx)", "description": "The details of the swap that the line item may belong to.", "optional": false, "defaultValue": "", "expandable": true, "children": [] }, { "name": "swap_id", "type": "`string`", "description": "The ID of the swap that the line item may belong to.", "optional": false, "defaultValue": "", "expandable": false, "children": [] }, { "name": "tax_lines", "type": "[LineItemTaxLine](LineItemTaxLine.mdx)[]", "description": "The details of the item's tax lines.", "optional": false, "defaultValue": "", "expandable": true, "children": [] }, { "name": "tax_total", "type": "``null`` \\| `number`", "description": "The total of tax of the line item", "optional": true, "defaultValue": "", "expandable": false, "children": [] }, { "name": "thumbnail", "type": "``null`` \\| `string`", "description": "A URL string to a small image of the contents of the Line Item.", "optional": false, "defaultValue": "", "expandable": false, "children": [] }, { "name": "title", "type": "`string`", "description": "The title of the Line Item.", "optional": false, "defaultValue": "", "expandable": false, "children": [] }, { "name": "total", "type": "``null`` \\| `number`", "description": "The total amount of the line item", "optional": true, "defaultValue": "", "expandable": false, "children": [] }, { "name": "unit_price", "type": "`number`", "description": "The price of one unit of the content in the Line Item. This should be in the currency defined by the Cart/Order/Swap/Claim that the Line Item belongs to.", "optional": false, "defaultValue": "", "expandable": false, "children": [] }, { "name": "updated_at", "type": "`Date`", "description": "The date with timezone at which the resource was updated.", "optional": false, "defaultValue": "", "expandable": false, "children": [] }, { "name": "variant", "type": "[ProductVariant](ProductVariant.mdx)", "description": "The details of the product variant that this item was created from.", "optional": false, "defaultValue": "", "expandable": true, "children": [] }, { "name": "variant_id", "type": "``null`` \\| `string`", "description": "The id of the Product Variant contained in the Line Item.", "optional": false, "defaultValue": "", "expandable": false, "children": [] } ]} /> ## Methods ### afterUpdateOrLoad `**afterUpdateOrLoad**(): void` #### Returns `void` ___ ### beforeInsert `Private **beforeInsert**(): void` #### Returns `void` ___ ### beforeUpdate `**beforeUpdate**(): void` #### Returns `void`