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_idstringRequiredThe cart's ID.
The line item to be created.
customHeadersRecord<string, any>RequiredCustom headers to attach to the request.
Default: {}
Returns
ResponsePromiseResponsePromise<StoreCartsRes>RequiredResolves to the associated cart's details.
ResponsePromiseResponsePromise<StoreCartsRes>Requireddelete
Delete a line item from a cart. The payment sessions will be updated and the totals will be recalculated.
Example
Parameters
cart_idstringRequiredThe ID of the line item's cart.
line_idstringRequiredThe ID of the line item to delete.
customHeadersRecord<string, any>RequiredCustom headers to attach to the request.
Default: {}
Returns
ResponsePromiseResponsePromise<StoreCartsRes>RequiredResolves to the associated cart's details.
ResponsePromiseResponsePromise<StoreCartsRes>Requiredupdate
Update a line item's data.
Example
Parameters
cart_idstringRequiredThe ID of the line item's cart.
line_idstringRequiredThe ID of the line item to update.
The data to update in the line item.
customHeadersRecord<string, any>RequiredCustom headers to attach to the request.
Default: {}
Returns
ResponsePromiseResponsePromise<StoreCartsRes>RequiredResolves to the associated cart's details.
ResponsePromiseResponsePromise<StoreCartsRes>RequiredWas this section helpful?