diff --git a/docs/content/guides/carts-in-medusa.mdx b/docs/content/guides/carts-in-medusa.mdx index 20f11f0c7e..4bf41ae131 100644 --- a/docs/content/guides/carts-in-medusa.mdx +++ b/docs/content/guides/carts-in-medusa.mdx @@ -1,3 +1,6 @@ +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + # How to Add Cart Functionality This document guides you through how you can add cart-related functionalities to your storefront. That includes creating and updating a cart and managing items in the cart. @@ -168,6 +171,9 @@ A cart has different data associated with it including the region, email, addres You can use the following snippet to update any of the cart’s data: + + + ```jsx medusa.carts.update(cartId, { region_id @@ -175,6 +181,9 @@ medusa.carts.update(cartId, { .then(({ cart }) => setCart(cart)); ``` + + + ```jsx fetch(`/store/carts/${cartId}`, { method: 'POST', @@ -189,6 +198,9 @@ fetch(`/store/carts/${cartId}`, { .then(({ cart }) => setCart(cart)); ``` + + + This request accepts the ID of the cart as a path parameter. In its body, you can pass any data you want to update in the cart such as the region. It returns the updated cart.