From 3f4e6a168b1b85bd578bb579c9719f1884d65ca7 Mon Sep 17 00:00:00 2001 From: Shahed Nasser Date: Tue, 19 Nov 2024 15:19:53 +0200 Subject: [PATCH] docs: remove section on updating cart's customer (#10154) * docs: add more clarification on updating a cart's customer * remove section --- .../cart/create/page.mdx | 4 -- .../cart/update/page.mdx | 41 ------------------- 2 files changed, 45 deletions(-) diff --git a/www/apps/resources/app/storefront-development/cart/create/page.mdx b/www/apps/resources/app/storefront-development/cart/create/page.mdx index 307d988600..84bcd6c969 100644 --- a/www/apps/resources/app/storefront-development/cart/create/page.mdx +++ b/www/apps/resources/app/storefront-development/cart/create/page.mdx @@ -118,7 +118,3 @@ This is necessary, as only products matching the cart's sales channel(s) can be ## Associate Customer with Cart When the cart is created for a logged-in customer, it's automatically associated with that customer. - -If the customer is a guest, then later logs in, you can set their ID on the cart by updating it. - -Refer to [this documentation](../update/page.mdx#update-carts-customer) to learn how to set the customer of a cart. \ No newline at end of file diff --git a/www/apps/resources/app/storefront-development/cart/update/page.mdx b/www/apps/resources/app/storefront-development/cart/update/page.mdx index 03e0bf445b..99d52e9a47 100644 --- a/www/apps/resources/app/storefront-development/cart/update/page.mdx +++ b/www/apps/resources/app/storefront-development/cart/update/page.mdx @@ -46,44 +46,3 @@ fetch(`http://localhost:9000/store/carts/${cartId}`, { ``` The Update Cart API route accepts a `region_id` request body parameter, whose value is the new region to associate with the cart. - ---- - -## Update Cart's Customer - -If a guest customer logs in, you must update the cart to be associated with the logged-in customer. - - - -You can't change the `customer_id` if the cart was associated with a customer previously. - - - -For example: - -export const updateCustomerHighlights = [ - ["11", `"logged_in_id"`, "Pass the logged-in customer's ID."] -] - -```ts highlights={updateCustomerHighlights} -fetch(`http://localhost:9000/store/carts/${cartId}`, { - credentials: "include", - method: "POST", - headers: { - "Content-Type": "application/json", - headers: { - "x-publishable-api-key": process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY, - }, - }, - body: JSON.stringify({ - customer_id: "logged_in_id", - }), -}) -.then((res) => res.json()) -.then(({ cart }) => { - // use cart... - console.log(cart) -}) -``` - -The Update Cart API route accepts a `customer_id` request body parameter, whose value is the customer to associate with the cart.