updateOrderItem - Order Module Reference

This documentation provides a reference to the updateOrderItem 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.

updateOrderItem(selector, data, sharedContext?): Promise<OrderItemDTO[]>#

This method updates existing order items matching the specified filters.

Example#

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

Parameters#

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

Returns#

PromisePromise<OrderItemDTO[]>
The updated order items.

updateOrderItem(orderItemId, data, sharedContext?): Promise<OrderItemDTO>#

This method updates an existing order item.

Example#

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

Parameters#

orderItemIdstring
The order item's ID.
dataPartial<UpdateOrderItemDTO>
The data to update in the order item.
sharedContextContextOptional
A context used to share resources, such as transaction manager, between the application and the module.

Returns#

PromisePromise<OrderItemDTO>
The updated order item.

updateOrderItem(orderItemIdOrDataOrSelector, data?, sharedContext?): Promise<OrderItemDTO | OrderItemDTO[]>#

This method updates existing order items. The items are identified either by their ID or the specified filters.

Example#

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

Parameters#

orderItemIdOrDataOrSelectorstring | Partial<OrderItemDTO> | UpdateOrderItemWithSelectorDTO[]
Either the ID of an order item, or the filters specifying which order items to update.
dataUpdateOrderItemDTO | Partial<UpdateOrderItemDTO>Optional
The data to update.
sharedContextContextOptional
A context used to share resources, such as transaction manager, between the application and the module.

Returns#

PromisePromise<OrderItemDTO | OrderItemDTO[]>
The updated order items.
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