1 export const metadata = {
2 title: `Cart Concepts`,
3 }
4
5 # {metadata.title}
6
7 In this document, you’ll learn about the main concepts related to carts in Medusa.
8
9 ## Cart
10
11 A cart is the selection of product variants that a customer intends to purchase. It is represented by the [Cart data model](/references/cart/models/Cart).
12
13 A cart holds information about:
14
15 - The items the customer wants to buy.
16 - The customer's shipping and billing addresses.
17 - The shipping methods used to fulfill the items after purchase.
18 - The payment method and information necessary to complete the purchase.
19 - These are stored and handled by the [Payment Module](../../payment/page.mdx).
20
21 ### Cart Locale
22
23 <Note>
24
25 Cart locale is available starting [Medusa v2.12.3](https://github.com/medusajs/medusa/releases/tag/v2.12.3).
26
27 </Note>
28
29 The `Cart` data model has a `locale` property that indicates the locale of the cart. This locale is in the [IETF BCP 47 standard](https://gist.github.com/typpo/b2b828a35e683b9bf8db91b5404f1bd1) format, such as `en-US` for American English or `fr-FR` for French (France).
30
31 When creating a cart, you can set the `locale` property to specify the desired locale for the cart. The information of the items in the cart, such as product titles and descriptions, will be displayed in the specified locale if translations are available.
32
33 Refer to the [Translation Module](../../translation/page.mdx) to learn more about how translations and locales work.
34
35 ### Cart Currency
36
37 A cart's currency is determined by its region. When you create a cart using the [createCartWorkflow](/references/medusa-workflows/createCartWorkflow), if you provide a `currency_code`, it must match the `currency_code` of the cart's region. Otherwise, an error is thrown.
38
39 If you don't provide a `currency_code`, the cart will use the region's currency automatically.
40
41 <Note>
42
43 This behavior is enforced since [Medusa v2.21.0](https://github.com/medusajs/medusa/releases/tag/v2.21.0).
44
45 </Note>
46
47 ---
48
49 ## Line Items
50
51 A line item, represented by the [LineItem](/references/cart/models/LineItem) data model, is a quantity of a product variant added to the cart. A cart has multiple line items.
52
53 <Note>
54
55 In the Medusa application, a product variant is implemented in the [Product Module](../../product/page.mdx).
56
57 </Note>
58
59 A line item stores some of the product variant’s properties, such as the `product_title` and `product_description`. It also stores data related to the item’s quantity and price.
60
61 ---
62
63 ## Shipping and Billing Addresses
64
65 A cart has a shipping and billing address. Both of these addresses are represented by the [Address data model](/references/cart/models/Address).
66
67 ![A diagram showcasing the relation between the Cart and Address data models](https://res.cloudinary.com/dza7lstvk/image/upload/v1711532392/Medusa%20Resources/cart-addresses_ls6qmv.jpg)
68
69 ---
70
71 ## Shipping Methods
72
73 A shipping method, represented by the [ShippingMethod data model](/references/cart/models/ShippingMethod), is used to fulfill the items in the cart after the order is placed. A cart can have multiple shipping methods, which is useful when items have different shipping profiles or require different fulfillment providers.
74
75 In the Medusa application, the shipping method is created from a shipping option, available through the [Fulfillment Module](../../fulfillment/page.mdx). Its ID is stored in the `shipping_option_id` property of the method.
76
77 <Note>
78
79 Adding multiple shipping methods in a single request is available since Medusa [v2.16.0](https://github.com/medusajs/medusa/releases/tag/v2.16.0).
80
81 </Note>
82
83 ### data Property
84
85 After an order is placed, you can use a third-party fulfillment provider to fulfill its shipments.
86
87 If the fulfillment provider requires additional custom data to be passed along from the checkout process, set this data in the `ShippingMethod`'s `data` property.
88
89 The `data` property is an object used to store custom data relevant later for fulfillment.