LineItemsResource
This class is used to send requests to Line Item API Routes part of the Store Cart API Routes. All its method
are available in the JS Client under the medusa.carts.lineItems
property.
Methods
create
Generates a Line Item with a given Product Variant and adds it to the Cart
Example
Parameters
cart_id
stringRequiredThe cart's ID.
The line item to be created.
customHeaders
Record<string, any>RequiredCustom headers to attach to the request.
Default: {}
Returns
ResponsePromise
ResponsePromise<StoreCartsRes>RequiredResolves to the associated cart's details.
ResponsePromise
ResponsePromise<StoreCartsRes>Requireddelete
Delete a line item from a cart. The payment sessions will be updated and the totals will be recalculated.
Example
Parameters
cart_id
stringRequiredThe ID of the line item's cart.
line_id
stringRequiredThe ID of the line item to delete.
customHeaders
Record<string, any>RequiredCustom headers to attach to the request.
Default: {}
Returns
ResponsePromise
ResponsePromise<StoreCartsRes>RequiredResolves to the associated cart's details.
ResponsePromise
ResponsePromise<StoreCartsRes>Requiredupdate
Update a line item's data.
Example
Parameters
cart_id
stringRequiredThe ID of the line item's cart.
line_id
stringRequiredThe ID of the line item to update.
The data to update in the line item.
customHeaders
Record<string, any>RequiredCustom headers to attach to the request.
Default: {}
Returns
ResponsePromise
ResponsePromise<StoreCartsRes>RequiredResolves to the associated cart's details.
ResponsePromise
ResponsePromise<StoreCartsRes>RequiredWas this section helpful?