updateOrderLineItems - Order Module Reference

This documentation provides a reference to the updateOrderLineItems method. This belongs to the Order Module.

NoteYou should only use this methods when implementing complex customizations. For common cases, check out available workflows instead.

updateOrderLineItems(data, sharedContext?): Promise<OrderLineItemDTO[]>#

This method updates existing line items. The line item to update is specified by the selector property of the first parameter.

Example#

Code
1const lineItems = await orderModuleService.updateOrderLineItems([2  {3    selector: {4      id: "123"5    },6    data: {7      quantity: 28    }9  }10])

Parameters#

The attributes to update in the order line item with selector.
sharedContextContextOptional
A context used to share resources, such as transaction manager, between the application and the module.

Returns#

PromisePromise<OrderLineItemDTO[]>
The updated line items.

updateOrderLineItems(selector, data, sharedContext?): Promise<OrderLineItemDTO[]>#

This method updates existing line items matching the specified filters.

Example#

Code
1const lineItems = await orderModuleService.updateOrderLineItems({2  id: "123"3}, {4  quantity: 25})

Parameters#

The filters specifying which line items to update.
The data to update in the line items.
sharedContextContextOptional
A context used to share resources, such as transaction manager, between the application and the module.

Returns#

PromisePromise<OrderLineItemDTO[]>
The updated line items.

updateOrderLineItems(lineId, data, sharedContext?): Promise<OrderLineItemDTO>#

This method updates an existing line item.

Example#

Code
1const lineItem = await orderModuleService.updateOrderLineItems(2  "123",3  {4    quantity: 25  }6)

Parameters#

lineIdstring
The line items's ID.
The data to update in the line item.
sharedContextContextOptional
A context used to share resources, such as transaction manager, between the application and the module.

Returns#

PromisePromise<OrderLineItemDTO>
The updated line item.
Was this page helpful?
Ask Anything
FAQ
What is Medusa?
How can I create a module?
How can I create a data model?
How do I create a workflow?
How can I extend a data model in the Product Module?
Recipes
How do I build a marketplace with Medusa?
How do I build digital products with Medusa?
How do I build subscription-based purchases with Medusa?
What other recipes are available in the Medusa documentation?
Chat is cleared on refresh
Line break