Back to Medusa

Cart Module Events Reference

www/apps/resources/references/module_events/module_events.Cart/page.mdx

2.14.25.0 KB
Original Source

import { TypeList } from "docs-ui"

Cart Module Events Reference

This reference shows all the events emitted by the Medusa application related to the Cart Module. If you use the module outside the Medusa application, these events aren't emitted.

Summary

<Table> <Table.Header> <Table.Row> <Table.HeaderCell> Event </Table.HeaderCell> <Table.HeaderCell> Description </Table.HeaderCell> </Table.Row> </Table.Header> <Table.Body> <Table.Row> <Table.Cell> [cart.created](#cartcreated) </Table.Cell> <Table.Cell> Emitted when a cart is created. </Table.Cell> </Table.Row> <Table.Row> <Table.Cell> [cart.updated](#cartupdated) </Table.Cell> <Table.Cell> Emitted when a cart's details are updated. </Table.Cell> </Table.Row> <Table.Row> <Table.Cell> [cart.region_updated](#cartregion_updated) </Table.Cell> <Table.Cell> Emitted when the cart's region is updated. This event is emitted alongside the `cart.updated` event. </Table.Cell> </Table.Row> <Table.Row> <Table.Cell> [cart.customer_transferred](#cartcustomer_transferred) <Tooltip text="This event was added in version v2.8.0"><Badge variant="blue">v2.8.0</Badge></Tooltip> </Table.Cell> <Table.Cell> Emitted when the customer in the cart is transferred. </Table.Cell> </Table.Row> </Table.Body> </Table>

<EventHeader headerLvl="2" headerProps={{ id: "cartcreated", children: (<>cart.created</>), className: "flex flex-wrap justify-center gap-docs_0.25" }} eventName="cart.created" payload={\``ts { id, // The ID of the cart } ````} />

Emitted when a cart is created.

Payload

ts
{
  id, // The ID of the cart
}

Workflows Emitting this Event

The following workflows emit this event when they're executed. These workflows are executed by Medusa's API routes. You can also view the events emitted by API routes in the Store and Admin API references.


<EventHeader headerLvl="2" headerProps={{ id: "cartupdated", children: (<>cart.updated</>), className: "flex flex-wrap justify-center gap-docs_0.25" }} eventName="cart.updated" payload={\``ts { id, // The ID of the cart } ````} />

Emitted when a cart's details are updated.

Payload

ts
{
  id, // The ID of the cart
}

Workflows Emitting this Event

The following workflows emit this event when they're executed. These workflows are executed by Medusa's API routes. You can also view the events emitted by API routes in the Store and Admin API references.


<EventHeader headerLvl="2" headerProps={{ id: "cartregion_updated", children: (<>cart.region_updated</>), className: "flex flex-wrap justify-center gap-docs_0.25" }} eventName="cart.region_updated" payload={\``ts { id, // The ID of the cart } ````} />

Emitted when the cart's region is updated. This event is emitted alongside the cart.updated event.

Payload

ts
{
  id, // The ID of the cart
}

Workflows Emitting this Event

The following workflows emit this event when they're executed. These workflows are executed by Medusa's API routes. You can also view the events emitted by API routes in the Store and Admin API references.


<EventHeader headerLvl="2" headerProps={{ id: "cartcustomer_transferred", children: (<>cart.customer_transferred <Tooltip text="This event was added in version v2.8.0"> <Badge variant="blue">v2.8.0</Badge> </Tooltip></>), className: "flex flex-wrap justify-center gap-docs_0.25" }} eventName="cart.customer_transferred" payload={\``ts { id, // The ID of the cart customer_id, // The ID of the customer } ````} />

Emitted when the customer in the cart is transferred.

Payload

ts
{
  id, // The ID of the cart
  customer_id, // The ID of the customer
}

Workflows Emitting this Event

The following workflows emit this event when they're executed. These workflows are executed by Medusa's API routes. You can also view the events emitted by API routes in the Store and Admin API references.