Skip to content

Commit

Permalink
code review improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
karyna-tsymbal-atwix committed Dec 11, 2021
1 parent 12bf9de commit 3e09345
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
Expand Up @@ -12,12 +12,14 @@ The customer must be logged in (You must specify the customer’s authorization
If this mutation is successful, the customer's shopping cart becomes inactive and all the products it contains are added to the contents of the guest cart (the active one).
Customer now is assigned to that active cart.

*Note:*
{:.bs-callout-info}
Customer cart becomes inactive and the guest cart remains active; but for guest cart new `masked_id` is being generated.
`quote_id` remains same.

The other similar mutation, [mergeCarts]({{page.baseurl}}/graphql/mutations/merge-carts.html), just merges cart items.
Unlike `assignCustomerToGuestCart`, it transfers the contents of a guest cart into the customer's cart. The mutation deletes the original guest cart.
This mutation requires a valid [customer authentication token]({{page.baseurl}}/graphql/mutations/generate-customer-token.html).

{:.bs-callout-info}
Use the [mergeCarts]({{page.baseurl}}/graphql/mutations/merge-carts.html) mutation to transfer the contents of a guest cart into a customer's cart.

## Syntax

Expand All @@ -33,7 +35,7 @@ mutation {

## Example usage

Assuming that there is a logged in customer who has an item in the cart, this call will merge customer's cart item to the specified guest shopping cart (which also contains an item).
In the following example, the customer and guest carts each contain one item. The mutation merges the customer's cart to the guest cart. As a result, the guest cart contains two items.

**Request:**

Expand Down
3 changes: 2 additions & 1 deletion src/guides/v2.4/graphql/mutations/merge-carts.md
Expand Up @@ -7,7 +7,8 @@ The `mergeCarts` mutation transfers the contents of a guest cart into the cart o

The mutation retains any items that were already in the logged-in customer's cart. If both the guest and customer carts contain the same item, `mergeCarts` adds the quantities. Upon success, the mutation deletes the original guest cart.

There is a similar [assignCustomerToGuestCart]({{page.baseurl}}/graphql/mutations/assign-customer-to-guest-cart.html) mutation which works in a different way: it assigns a logged in customer and merge customer's shopping cart items to the guest shopping cart.
{:.bs-callout-info}
Use the [assignCustomerToGuestCart]({{page.baseurl}}/graphql/mutations/assign-customer-to-guest-cart.html) mutation to assign the contents of a logged-in customer's cart to a guest cart.
Customer cart becomes inactive and the guest cart remains active.

## Syntax
Expand Down

0 comments on commit 3e09345

Please sign in to comment.