diff --git a/src/_data/toc/graphql.yml b/src/_data/toc/graphql.yml index 2524c90a987..a500de1f29e 100644 --- a/src/_data/toc/graphql.yml +++ b/src/_data/toc/graphql.yml @@ -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 @@ -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 @@ -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 diff --git a/src/guides/v2.4/graphql/mutations/add-products-to-requisition-list.md b/src/guides/v2.4/graphql/mutations/add-products-to-requisition-list.md new file mode 100644 index 00000000000..91f8f9c4c5f --- /dev/null +++ b/src/guides/v2.4/graphql/mutations/add-products-to-requisition-list.md @@ -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 %} diff --git a/src/guides/v2.4/graphql/mutations/add-requisition-list-items-to-cart.md b/src/guides/v2.4/graphql/mutations/add-requisition-list-items-to-cart.md new file mode 100644 index 00000000000..c9c845c3197 --- /dev/null +++ b/src/guides/v2.4/graphql/mutations/add-requisition-list-items-to-cart.md @@ -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 %} diff --git a/src/guides/v2.4/graphql/mutations/clear-customer-cart.md b/src/guides/v2.4/graphql/mutations/clear-customer-cart.md new file mode 100644 index 00000000000..cfde63030aa --- /dev/null +++ b/src/guides/v2.4/graphql/mutations/clear-customer-cart.md @@ -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 %} diff --git a/src/guides/v2.4/graphql/mutations/update-requisition-list-items.md b/src/guides/v2.4/graphql/mutations/update-requisition-list-items.md new file mode 100644 index 00000000000..e7db747f3b5 --- /dev/null +++ b/src/guides/v2.4/graphql/mutations/update-requisition-list-items.md @@ -0,0 +1,111 @@ +--- +group: graphql +title: updateRequisitionListItems mutation +b2b_only: true +contributor_name: EY +--- +The `updateRequisitionListItems` mutation updates products in 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 { + updateRequisitionListItems( + requisitionListUid: ID! + requisitionListItems: [UpdateRequisitionListItemsInput!]! + ) { + UpdateRequisitionListItemsOutput + } +} +``` + +## Example usage + +The following example updates the quantity of an item in a requisition list. + +**Request:** + +``` graphql +mutation { + updateRequisitionListItems( + requisitionListUid: "Y29uZmlndXJhYmxlLzkzLzUz", + requisitionListItems: [ + { + item_id: "W29uZmlndXJhYmxlLzkzLzUz" + quantity: 2 + } + ] + ) { + requisition_list { + uid + items_count + items { + items { + uid + quantity + } + } + } + } +} +``` + +**Response:** + +``` json +{ + "data": { + "updateRequisitionListItems": { + "requisition_list": { + "uid": "1", + "items_count": 1, + "items": { + "items": { + "uid": "1", + "quantity": 2 + } + } + } + } + } +} +``` + +## Input attributes + +The `updateRequisitionListItems` mutation requires the following input. + +Attribute | Data Type | Description +--- | --- | --- +`requisitionListItems`| [[UpdateRequisitionListItemsInput](#UpdateRequisitionListItemsInput)!]! | An array of products to be updated in the requisition list +`requisitionListUid`| ID! | The unique ID of the requisition list + +### UpdateRequisitionListItemsInput attributes {#UpdateRequisitionListItemsInput} + +The `UpdateRequisitionListItemsInput` type contains the list of products to be updated in the requisition list. + +Attribute | Data Type | Description +--- | --- | --- +`entered_options` | [EnteredOptionInput!] | An array of customer entered option IDs +`item_id` | ID! | The ID of the requisition list item to update +`quantity` | Float | The new quantity of the item +`selected_options` | [String!] | An array of selected option IDs + +## Output attributes + +The `updateRequisitionListItems` object returns the requisition list object. + +Attribute | Data Type | Description +--- | --- | --- +`requisition_list` | [[RequisitionList](#RequisitionList)] | The requisition list after the items were updated + +### RequisitionList attributes {#RequisitionList} + +The `RequisitionList` object can contain the following attributes. + +{% include graphql/requisition-list.md %}