You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: design-documents/graph-ql/coverage/add-items-to-cart.md
+9-7Lines changed: 9 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,7 @@
1
1
**Overview**
2
2
3
+
:warning: Current proposal is deprecated in favor of [add-items-to-cart-single-mutation.md](add-items-to-cart-single-mutation.md)
4
+
3
5
As a Magento developer, I need to manipulate the shopping cart via GraphQL so that I can programmatically create orders on behalf of a shopper.
4
6
5
7
GraphQL needs to provide sufficient mutations (ways to create/update/delete data) for a developer to build out the storefront checkout experience for a shopper.
@@ -31,13 +33,13 @@ GraphQL needs to provide sufficient mutations (ways to create/update/delete data
Registered customer should be able to work with the same shopping cart using multiple devices. For example, add products to cart using a laptop and complete checkout using a smartphone.
4
+
5
+
6
+
## Proposed solution
7
+
8
+
To achieve desired behavior there should be a way to retrieve active customer cart ID from the server. Based on the assumption that there could be only one active cart per customer at any given moment this can be done as follows:
9
+
```graphql
10
+
getMyCartId(): String!
11
+
```
12
+
This operation will only work for registered customers (valid customer token must be provided in headers).
13
+
14
+
### Scenario
15
+
16
+
In the following scenario a logged in user adds a product to the cart. After logging in to his account from the smartphone the cart still contains added product (actual GraphQL queries are replaced with pseudocode for simplicity):
- It is possible to make `cartId` optional argument and rely on `getCart {cart_id}` query for fetching customer cart ID. When used by customer, ID is not required. When used by guest - ID is required.
29
+
- guest still need to use `createEmptyCart` to obtain cart ID
0 commit comments