From 60cd94fd60f5e4c74b568e8abc0a62560f899480 Mon Sep 17 00:00:00 2001 From: Zainab Lawal Date: Thu, 13 Oct 2022 12:59:08 +0300 Subject: [PATCH] docs: added missing import for add cart functionality documentation (#2425) * Add missing import for add cart functionality file * Added the Tab section to the Update Cart section * Removed unnecessary spaces --- docs/content/guides/carts-in-medusa.mdx | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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.