updateCarts - Cart Module Reference

This documentation provides a reference to the updateCarts method. This belongs to the Cart Module.

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

updateCarts(data): Promise<CartDTO[]>#

This method updates existing carts.

Example#

Code
1const carts = await cartModuleService.updateCarts([2  {3    id: "cart_123",4    region_id: "reg_123",5  },6  {7    id: "cart_321",8    customer_id: "cus_123",9  },10])

Parameters#

The attributes to update in the carts.

Returns#

PromisePromise<CartDTO[]>
The updated carts.

updateCarts(cartId, data, sharedContext?): Promise<CartDTO>#

This method updates an existing cart.

Example#

Code
1const cart = await cartModuleService.updateCarts("cart_123", {2  region_id: "reg_123",3})

Parameters#

cartIdstring
The cart's ID.
The attributes to update in the cart data.
sharedContextContextOptional
A context used to share resources, such as transaction manager, between the application and the module.

Returns#

PromisePromise<CartDTO>
The updated cart.

updateCarts(selector, data, sharedContext?): Promise<CartDTO[]>#

This method updates existing carts matching the specified filters.

Example#

Code
1const carts = await cartModuleService.updateCarts(2  {3    currency_code: "usd",4  },5  {6    region_id: "reg_123",7  }8)

Parameters#

selectorPartial<CartDTO>
The filters that specify which carts to update.
The attributes to update in the carts.
sharedContextContextOptional
A context used to share resources, such as transaction manager, between the application and the module.

Returns#

PromisePromise<CartDTO[]>
The updated carts.
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