Skip to content

Commit

Permalink
Merge pull request magento-commerce/devdocs#3038 from magento-l3/ACP2…
Browse files Browse the repository at this point in the history
…E-993

ACP2E-993: [Documentation] user_errors is a field u can select to get error for addProductsToCart GraphQL Mutation
  • Loading branch information
jeff-matthews committed Jun 30, 2022
2 parents f987338 + 0066a0b commit 035e859
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 8 deletions.
6 changes: 6 additions & 0 deletions src/_includes/graphql/cart-user-input-errors.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
The `CartUserInputError` object contains information about errors that are specific to carts.

| Attribute | Data Type | Description |
|-----------|-------------------------|------------------------------------------------------------------------------------------------------------------------------|
| `code` | CartUserInputErrorType! | A cart-specific error code. Possible values include `PRODUCT_NOT_FOUND`, `NOT_SALABLE`, `INSUFFICIENT_STOCK` and `UNDEFINED` |
| `message` | String! | A localized error message |
50 changes: 42 additions & 8 deletions src/guides/v2.4/graphql/mutations/add-products-to-cart.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ mutation {
quantity
}
}
user_errors {
code
message
}
}
}
```
Expand All @@ -96,7 +100,8 @@ mutation {
"quantity": 1
}
]
}
},
"user_errors": []
}
}
}
Expand Down Expand Up @@ -134,6 +139,10 @@ mutation {
quantity
}
}
user_errors {
code
message
}
}
}
```
Expand Down Expand Up @@ -163,7 +172,8 @@ mutation {
"quantity": 1
}
]
}
},
"user_errors": []
}
}
}
Expand Down Expand Up @@ -204,6 +214,10 @@ mutation {
quantity
}
}
user_errors {
code
message
}
}
}
```
Expand Down Expand Up @@ -238,7 +252,8 @@ mutation {
"quantity": 1
}
]
}
},
"user_errors": []
}
}
}
Expand Down Expand Up @@ -287,6 +302,10 @@ mutation {
quantity
}
}
user_errors {
code
message
}
}
}
```
Expand Down Expand Up @@ -320,7 +339,8 @@ mutation {
"quantity": 1
}
]
}
},
"user_errors": []
}
}
}
Expand Down Expand Up @@ -385,6 +405,10 @@ mutation {
}
}
}
user_errors {
code
message
}
}
}
```
Expand Down Expand Up @@ -460,7 +484,8 @@ mutation {
]
}
]
}
},
"user_errors": []
}
}
}
Expand Down Expand Up @@ -516,6 +541,10 @@ mutation {
}
}
}
user_errors {
code
message
}
}
}
```
Expand Down Expand Up @@ -543,16 +572,21 @@ The `CartItemInput` object must contain the following attributes:

The `AddProductsToCartOutput` object contains the `Cart` object.

Attribute | Data Type | Description
--- | --- | ---
`cart` |[Cart!](#CartObject) | Describes the contents of the specified shopping cart
| Attribute | Data Type | Description |
|---------------|--------------------------------------------|----------------------------------------------------------------|
| `cart` | [Cart!](#CartObject) | Describes the contents of the specified shopping cart |
| `user_errors` | [CartUserInputError!](#CartUserInputError) | An array of errors encountered while adding products to a cart |

### Cart object {#CartObject}

{% include graphql/cart-object.md %}

[Cart query output]({{page.baseurl}}/graphql/queries/cart.html#cart-output) provides more information about the `Cart` object.

### CartUserInputError attributes {#CartUserInputError}

{% include graphql/cart-user-input-errors.md %}

## Errors

Code | Error | Description
Expand Down

0 comments on commit 035e859

Please sign in to comment.