docs: remove section on updating cart's customer (#10154)

* docs: add more clarification on updating a cart's customer

* remove section
This commit is contained in:
Shahed Nasser
2024-11-19 15:19:53 +02:00
committed by GitHub
parent 1f44281ed6
commit 3f4e6a168b
2 changed files with 0 additions and 45 deletions

View File

@@ -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.

View File

@@ -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.
<Note>
You can't change the `customer_id` if the cart was associated with a customer previously.
</Note>
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.