addProductsToRequisitionList mutation

Magento Commerce for B2B only

The content on this page is for Magento Commerce for B2B only. Learn more

The addProductsToRequisitionList mutation adds products to a requisition list.

This mutation requires a valid customer authentication token.

Use the storeConfig query with the is_requisition_list_active attribute to determine whether requisition lists are enabled.

Syntax

1
2
3
4
5
6
7
8
mutation {
  addProductsToRequisitionList(
    requisitionListUid: ID!
    requisitionListItems: [RequisitionListItemsInput!]!
  ) {
    AddProductsToRequisitionListOutput
  }
}

Example usage

The following example adds products to a requisition list.

Request:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
mutation {
  addProductsToRequisitionList(
      requisitionListUid: "Mg=="
      requisitionListItems: [
        {
            sku: "MS10"
            quantity: 1
            selected_options: ["Y29uZmlndXJhYmxlLzkzLzUw","Y29uZmlndXJhYmxlLzE2MC8xNjg"]
        }
      ]
    ) {
    requisition_list {
      uid
      items {
        items {
          ... on RequisitionListItemInterface {
            uid
            product {
              uid
              sku
              name
            }
            quantity
          }
        }
      }
      items_count
    }
  }
}

Response:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
{
  "data": {
    "addProductsToRequisitionList": {
      "requisition_list": {
        "uid": "Mg==",
        "items": {
          "items": [
            {
              "uid": "Mw==",
              "product": {
                "uid": "NTk2",
                "sku": "MS10",
                "name": "Logan  HeatTec® Tee"
              },
              "quantity": 1
            }
          ]
        },
        "items_count": `
      }
    }
  }
}

Input attributes

The addProductsToRequisitionList mutation requires the following input.

Attribute Data Type Description
requisitionListItems [RequisitionListItemsInput!]! An array of products to be added to the requisition list
requisitionListUid ID! The unique ID of the requisition list

RequisitionListItemsInput attributes

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] The requisition list after the items were added

RequisitionList attributes

The RequisitionList object contains the following attributes.

Attribute Data Type Description
description String Optional text that describes the requisition list
items RequistionListItems An array of products added to the requisition list
items_count Int! The number of items in the list
name String! The requisition list name
uid ID! The unique requisition list ID
updated_at String The time of the last modification of the requisition list

RequistionListItems attributes

The RequistionListItems object contains the following attributes.

Attribute Data Type Description
items [RequisitionListItemInterface]! An array of items in the requisition list
page_info SearchResultPageInfo Contains pagination metadata
total_pages Int! The number of pages returned