Skip to content
This repository was archived by the owner on Nov 19, 2024. It is now read-only.

Commit 56f0035

Browse files
chiranjeevi-cjrogyarkeharper
authored
8341 requisition list mutations (#8354)
* Added documentation for requisition list mutation * Added quotes to the status * removed cart object in clearCustomerCart input attributes table * Followed the standards and changed the anchor names * Update src/_includes/graphql/requisition-list.md Co-authored-by: Yaroslav Rogoza <[email protected]> * Apply suggestions from code review Co-authored-by: Yaroslav Rogoza <[email protected]> * arranged the attributes in alphabetical order and added uid in requisition list * removed blank space * Apply suggestions from code review Co-authored-by: Kevin Harper <[email protected]> * updated the updateRequisitionListItems mutation * Delete requisition-list.md * updated the files * Update add-requisition-list-items-to-cart.md * Update clear-customer-cart.md * Update update-requisition-list-items.md Co-authored-by: Yaroslav Rogoza <[email protected]> Co-authored-by: Kevin Harper <[email protected]>
1 parent 9982f26 commit 56f0035

File tree

5 files changed

+402
-0
lines changed

5 files changed

+402
-0
lines changed

src/_data/toc/graphql.yml

+17
Original file line numberDiff line numberDiff line change
@@ -181,10 +181,18 @@ pages:
181181
- label: addDownloadableProductsToCart mutation
182182
url: /graphql/mutations/add-downloadable-products.html
183183

184+
- label: addProductsToRequisitionList mutation
185+
url: /graphql/mutations/add-products-to-requisition-list.html
186+
exclude_versions: [ "2.3" ]
187+
184188
- label: addProductsToWishlist mutation
185189
url: /graphql/mutations/add-products-to-wishlist.html
186190
exclude_versions: ["2.3"]
187191

192+
- label: addRequisitionListItemsToCart mutation
193+
url: /graphql/mutations/add-requisition-list-items-to-cart.html
194+
exclude_versions: [ "2.3" ]
195+
188196
- label: addSimpleProductsToCart mutation
189197
url: /graphql/mutations/add-simple-products.html
190198

@@ -210,6 +218,11 @@ pages:
210218
- label: changeCustomerPassword mutation
211219
url: /graphql/mutations/change-customer-password.html
212220

221+
- label: clearCustomerCart mutation
222+
url: /graphql/mutations/clear-customer-cart.html
223+
edition: b2b-only
224+
exclude_versions: [ "2.3" ]
225+
213226
- label: copyItemsBetweenRequisitionLists mutation
214227
url: /graphql/mutations/copy-items-between-requisition-lists.html
215228
edition: b2b-only
@@ -464,6 +477,10 @@ pages:
464477
url: /graphql/mutations/update-products-in-wishlist.html
465478
exclude_versions: ["2.3"]
466479

480+
- label: updateRequisitionListItems mutation
481+
url: /graphql/mutations/update-requisition-list-items.html
482+
exclude_versions: [ "2.3" ]
483+
467484
- label: updateWishlist mutation
468485
url: /graphql/mutations/update-wishlist.html
469486
edition: ee-only
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
---
2+
group: graphql
3+
title: addProductsToRequisitionList mutation
4+
b2b_only: true
5+
contributor_name: EY
6+
---
7+
The `addProductsToRequisitionList` mutation adds products to a requisition list.
8+
9+
This mutation requires a valid [customer authentication token]({{page.baseurl}}/graphql/mutations/generate-customer-token.html).
10+
11+
{:.bs-callout-info}
12+
Use the [storeConfig query]({{page.baseurl}}/graphql/queries/store-config.html) with the `btob_website_configuration_requisition_list_active` attribute to determine whether requisition lists are supported.
13+
14+
## Syntax
15+
16+
```graphql
17+
mutation {
18+
addProductsToRequisitionList(
19+
requisitionListUid: ID!
20+
requisitionListItems: [RequisitionListItemsInput!]!
21+
) {
22+
AddProductsToRequisitionListOutput
23+
}
24+
}
25+
```
26+
27+
## Example usage
28+
29+
The following example adds products to a requisition list.
30+
31+
**Request:**
32+
33+
``` graphql
34+
mutation {
35+
addProductsToRequisitionList(
36+
requisitionListUid: "Y29uZmlndXJhYmxlLzkzLzUz"
37+
requisitionListItems: [
38+
{
39+
sku: "sku"
40+
quantity: 1
41+
selected_options: ["Y29uZmlndXJhYmxlLzkzLzUz","Y29uZmlndXJhYmxlLzE0NC8xNzE="]
42+
}
43+
]
44+
) {
45+
requisition_list {
46+
uid
47+
items_count
48+
}
49+
}
50+
}
51+
```
52+
53+
**Response:**
54+
55+
``` json
56+
{
57+
"data": {
58+
"addProductsToRequisitionList": {
59+
"requisition_list": {
60+
"uid": "1",
61+
"items_count": 1
62+
}
63+
}
64+
}
65+
}
66+
```
67+
68+
## Input attributes
69+
70+
The `addProductsToRequisitionList` mutation requires the following input.
71+
72+
Attribute | Data Type | Description
73+
--- | --- | ---
74+
`requisitionListItems`| [[RequisitionListItemsInput](#RequisitionListItemsInput)!]! | An array of products to be added to the requisition list
75+
`requisitionListUid`| ID! | The unique ID of the requisition list
76+
77+
### RequisitionListItemsInput attributes {#RequisitionListItemsInput}
78+
79+
The `RequisitionListItemsInput` type contains the list of products to add to a requisition list.
80+
81+
Attribute | Data Type | Description
82+
--- | --- | ---
83+
`entered_options` | [EnteredOptionInput!] | An array of customer entered option IDs
84+
`parent_sku` | String | For configurable products, the SKU of the parent product
85+
`quantity` | Float | The quantity of the product to add
86+
`selected_options` | [String!] | An array of selected option IDs
87+
`sku` | String! | The product SKU
88+
89+
## Output attributes
90+
91+
The `addProductsToRequisitionList` object returns the requisition list object.
92+
93+
Attribute | Data Type | Description
94+
--- | --- | ---
95+
`requisition_list` | [[RequisitionList](#RequisitionList)] | The requisition list after the items were added
96+
97+
### RequisitionList attributes {#RequisitionList}
98+
99+
The `RequisitionList` object can contain the following attributes.
100+
101+
{% include graphql/requisition-list.md %}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
---
2+
group: graphql
3+
title: addRequisitionListItemsToCart mutation
4+
b2b_only: true
5+
contributor_name: EY
6+
---
7+
The `addRequisitionListItemsToCart` mutation adds requisition list items to the cart.
8+
9+
This mutation requires a valid [customer authentication token]({{page.baseurl}}/graphql/mutations/generate-customer-token.html).
10+
11+
{:.bs-callout-info}
12+
Use the [storeConfig query]({{page.baseurl}}/graphql/queries/store-config.html) with the `btob_website_configuration_requisition_list_active` attribute to determine whether requisition lists are supported.
13+
14+
## Syntax
15+
16+
```graphql
17+
mutation {
18+
addRequisitionListItemsToCart (
19+
requisitionListUid: ID
20+
requisitionListItemUids: [ID!]
21+
) {
22+
AddRequisitionListItemsToCartOutput
23+
}
24+
}
25+
```
26+
27+
## Example usage
28+
29+
The following example adds items to the cart.
30+
31+
**Request:**
32+
33+
``` graphql
34+
mutation {
35+
addRequisitionListItemsToCart
36+
(
37+
requisitionListUid: "Y29uZmlndXJhYmxlLzkzLzUz"
38+
requisitionListItemUids: ["1","2"]
39+
) {
40+
status
41+
}
42+
}
43+
```
44+
45+
**Response:**
46+
47+
``` json
48+
{
49+
"data": {
50+
"addRequisitionListItemsToCart": {
51+
"status": "true"
52+
}
53+
}
54+
}
55+
```
56+
57+
## Input attributes
58+
59+
The `addRequisitionListItemsToCart` mutation requires the following input.
60+
61+
Attribute | Data Type | Description
62+
--- | --- | ---
63+
`requisitionListItemUids`| [ID!] | An array of UIDs presenting products to be added to the cart. If no UIDs are specified, all items in the requisition list will be added to the cart
64+
`requisitionListUid`| ID! | The unique ID of the requisition list
65+
66+
## Output attributes
67+
68+
The `addRequisitionListItemsToCart` object returns the status, cart and errors object.
69+
70+
Attribute | Data Type | Description
71+
--- | --- | ---
72+
`add_requisition_list_items_to_cart_user_errors` | [[AddRequisitionListItemToCartUserError!](#AddRequisitionListItemToCartUserError)] | Indicates why the attempt to add items to the requistion list was not successful
73+
`cart` | [Cart](#CartObject) | The cart after adding requisition list items.
74+
`status` | Boolean! | Indicates whether the attempt to add items to the requisition list was successful
75+
76+
### AddRequisitionListItemToCartUserError attributes {#AddRequisitionListItemToCartUserError}
77+
78+
The `AddRequisitionListItemToCartUserError` type contains the list of errors which indicates why the attempt to add items to the requistion list was not successful.
79+
80+
Attribute | Data Type | Description
81+
--- | --- | ---
82+
`message` | String! | A description of the error
83+
`type` | [AddRequisitionListItemToCartUserErrorType!](#AddRequisitionListItemToCartUserErrorType) | The Error type
84+
85+
### AddRequisitionListItemToCartUserErrorType {#AddRequisitionListItemToCartUserErrorType}
86+
87+
Type | Description
88+
--- | ---
89+
`LOW_QUANTITY` | The quantity of one of the items is low
90+
`OPTIONS_UPDATED` | The options have been updated
91+
`OUT_OF_STOCK` | One of the items is out of stock
92+
`UNAVAILABLE_SKU` | One of the items SKU is unavailable
93+
94+
### Cart object {#CartObject}
95+
96+
The `Cart` object can contain the following attributes.
97+
98+
{% include graphql/cart-object-24.md %}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
---
2+
group: graphql
3+
title: clearCustomerCart mutation
4+
b2b_only: true
5+
contributor_name: EY
6+
---
7+
The `clearCustomerCart` mutation clears the customer's cart.
8+
9+
This mutation requires a valid [customer authentication token]({{page.baseurl}}/graphql/mutations/generate-customer-token.html).
10+
11+
{:.bs-callout-info}
12+
Use the [storeConfig query]({{page.baseurl}}/graphql/queries/store-config.html) with the `btob_website_configuration_requisition_list_active` attribute to determine whether requisition lists are supported.
13+
14+
## Syntax
15+
16+
```graphql
17+
mutation {
18+
clearCustomerCart(
19+
cartUid: String!
20+
) {
21+
ClearCustomerCartOutput
22+
}
23+
}
24+
```
25+
26+
## Example usage
27+
28+
The following example clears the customer's cart.
29+
30+
**Request:**
31+
32+
``` graphql
33+
mutation {
34+
clearCustomerCart(
35+
cartUid: "1"
36+
) {
37+
status
38+
}
39+
}
40+
```
41+
42+
**Response:**
43+
44+
``` json
45+
{
46+
"data": {
47+
"clearCustomerCart": {
48+
"status": "true"
49+
}
50+
}
51+
}
52+
```
53+
54+
## Input attributes
55+
56+
The `clearCustomerCart` mutation requires the following input.
57+
58+
Attribute | Data Type | Description
59+
--- | --- | ---
60+
`cartUid`| String! | Indicates whether cart was cleared
61+
62+
## Output attributes
63+
64+
The `clearCustomerCart` object returns the status and cart object.
65+
66+
Attribute | Data Type | Description
67+
--- | --- | ---
68+
`cart` | [Cart](#CartObject) | The cart after clearing items
69+
`status` | Boolean! | The requisition list after the items were added
70+
71+
### Cart object {#CartObject}
72+
73+
The `Cart` object can contain the following attributes.
74+
75+
{% include graphql/cart-object-24.md %}

0 commit comments

Comments
 (0)