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

8341 requisition list mutations #8354

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions src/_data/toc/graphql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,18 @@ pages:
- label: addDownloadableProductsToCart mutation
url: /graphql/mutations/add-downloadable-products.html

- label: addProductsToRequisitionList mutation
url: /graphql/mutations/add-products-to-requisition-list.html
exclude_versions: [ "2.3" ]

- label: addProductsToWishlist mutation
url: /graphql/mutations/add-products-to-wishlist.html
exclude_versions: ["2.3"]

- label: addRequisitionListItemsToCart mutation
url: /graphql/mutations/add-requisition-list-items-to-cart.html
exclude_versions: [ "2.3" ]

- label: addSimpleProductsToCart mutation
url: /graphql/mutations/add-simple-products.html

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

- label: clearCustomerCart mutation
url: /graphql/mutations/clear-customer-cart.html
edition: b2b-only
exclude_versions: [ "2.3" ]

- label: copyItemsBetweenRequisitionLists mutation
url: /graphql/mutations/copy-items-between-requisition-lists.html
edition: b2b-only
Expand Down Expand Up @@ -464,6 +477,10 @@ pages:
url: /graphql/mutations/update-products-in-wishlist.html
exclude_versions: ["2.3"]

- label: updateRequisitionListItems mutation
url: /graphql/mutations/update-requisition-list-items.html
exclude_versions: [ "2.3" ]

- label: updateWishlist mutation
url: /graphql/mutations/update-wishlist.html
edition: ee-only
Expand Down
101 changes: 101 additions & 0 deletions src/guides/v2.4/graphql/mutations/add-products-to-requisition-list.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
---
group: graphql
title: addProductsToRequisitionList mutation
b2b_only: true
contributor_name: EY
---
The `addProductsToRequisitionList` mutation adds products to a requisition list.

This mutation requires a valid [customer authentication token]({{page.baseurl}}/graphql/mutations/generate-customer-token.html).

{:.bs-callout-info}
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.

## Syntax

```graphql
mutation {
addProductsToRequisitionList(
requisitionListUid: ID!
requisitionListItems: [RequisitionListItemsInput!]!
) {
AddProductsToRequisitionListOutput
}
}
```

## Example usage

The following example adds products to a requisition list.

**Request:**

``` graphql
mutation {
addProductsToRequisitionList(
requisitionListUid: "Y29uZmlndXJhYmxlLzkzLzUz"
requisitionListItems: [
{
sku: "sku"
quantity: 1
selected_options: ["Y29uZmlndXJhYmxlLzkzLzUz","Y29uZmlndXJhYmxlLzE0NC8xNzE="]
}
]
) {
requisition_list {
uid
items_count
}
}
}
```

**Response:**

``` json
{
"data": {
"addProductsToRequisitionList": {
"requisition_list": {
"uid": "1",
"items_count": 1
}
}
}
}
```

## Input attributes

The `addProductsToRequisitionList` mutation requires the following input.

Attribute | Data Type | Description
--- | --- | ---
`requisitionListItems`| [[RequisitionListItemsInput](#RequisitionListItemsInput)!]! | An array of products to be added to the requisition list
`requisitionListUid`| ID! | The unique ID of the requisition list

### RequisitionListItemsInput attributes {#RequisitionListItemsInput}

The `RequisitionListItemsInput` type contains the list of products to add to a requisition list.

Attribute | Data Type | Description
--- | --- | ---
`entered_options` | [EnteredOptionInput!] | An array of customer entered option IDs
`parent_sku` | String | For configurable products, the SKU of the parent product
`quantity` | Float | The quantity of the product to add
`selected_options` | [String!] | An array of selected option IDs
`sku` | String! | The product SKU

## Output attributes

The `addProductsToRequisitionList` object returns the requisition list object.

Attribute | Data Type | Description
--- | --- | ---
`requisition_list` | [[RequisitionList](#RequisitionList)] | The requisition list after the items were added

### RequisitionList attributes {#RequisitionList}

The `RequisitionList` object can contain the following attributes.

{% include graphql/requisition-list.md %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
---
group: graphql
title: addRequisitionListItemsToCart mutation
b2b_only: true
contributor_name: EY
---
The `addRequisitionListItemsToCart` mutation adds requisition list items to the cart.

This mutation requires a valid [customer authentication token]({{page.baseurl}}/graphql/mutations/generate-customer-token.html).

{:.bs-callout-info}
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.

## Syntax

```graphql
mutation {
addRequisitionListItemsToCart (
requisitionListUid: ID
requisitionListItemUids: [ID!]
) {
AddRequisitionListItemsToCartOutput
}
}
```

## Example usage

The following example adds items to the cart.

**Request:**

``` graphql
mutation {
addRequisitionListItemsToCart
(
requisitionListUid: "Y29uZmlndXJhYmxlLzkzLzUz"
requisitionListItemUids: ["1","2"]
) {
status
}
}
```

**Response:**

``` json
{
"data": {
"addRequisitionListItemsToCart": {
"status": "true"
}
}
}
```

## Input attributes

The `addRequisitionListItemsToCart` mutation requires the following input.

Attribute | Data Type | Description
--- | --- | ---
`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
`requisitionListUid`| ID! | The unique ID of the requisition list

## Output attributes

The `addRequisitionListItemsToCart` object returns the status, cart and errors object.

Attribute | Data Type | Description
--- | --- | ---
`add_requisition_list_items_to_cart_user_errors` | [[AddRequisitionListItemToCartUserError!](#AddRequisitionListItemToCartUserError)] | Indicates why the attempt to add items to the requistion list was not successful
`cart` | [Cart](#CartObject) | The cart after adding requisition list items.
`status` | Boolean! | Indicates whether the attempt to add items to the requisition list was successful

### AddRequisitionListItemToCartUserError attributes {#AddRequisitionListItemToCartUserError}

The `AddRequisitionListItemToCartUserError` type contains the list of errors which indicates why the attempt to add items to the requistion list was not successful.

Attribute | Data Type | Description
--- | --- | ---
`message` | String! | A description of the error
`type` | [AddRequisitionListItemToCartUserErrorType!](#AddRequisitionListItemToCartUserErrorType) | The Error type

### AddRequisitionListItemToCartUserErrorType {#AddRequisitionListItemToCartUserErrorType}

Type | Description
--- | ---
`LOW_QUANTITY` | The quantity of one of the items is low
`OPTIONS_UPDATED` | The options have been updated
`OUT_OF_STOCK` | One of the items is out of stock
`UNAVAILABLE_SKU` | One of the items SKU is unavailable

### Cart object {#CartObject}

The `Cart` object can contain the following attributes.

{% include graphql/cart-object-24.md %}
75 changes: 75 additions & 0 deletions src/guides/v2.4/graphql/mutations/clear-customer-cart.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
---
group: graphql
title: clearCustomerCart mutation
b2b_only: true
contributor_name: EY
---
The `clearCustomerCart` mutation clears the customer's cart.

This mutation requires a valid [customer authentication token]({{page.baseurl}}/graphql/mutations/generate-customer-token.html).

{:.bs-callout-info}
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.

## Syntax

```graphql
mutation {
clearCustomerCart(
cartUid: String!
) {
ClearCustomerCartOutput
}
}
```

## Example usage

The following example clears the customer's cart.

**Request:**

``` graphql
mutation {
clearCustomerCart(
cartUid: "1"
) {
status
}
}
```

**Response:**

``` json
{
"data": {
"clearCustomerCart": {
"status": "true"
}
}
}
```

## Input attributes

The `clearCustomerCart` mutation requires the following input.

Attribute | Data Type | Description
--- | --- | ---
`cartUid`| String! | Indicates whether cart was cleared

## Output attributes

The `clearCustomerCart` object returns the status and cart object.

Attribute | Data Type | Description
--- | --- | ---
`cart` | [Cart](#CartObject) | The cart after clearing items
`status` | Boolean! | The requisition list after the items were added

### Cart object {#CartObject}

The `Cart` object can contain the following attributes.

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