Requisition List Functions
The Requisition List drop-in provides 11 API functions for managing requisition lists and their items, including creating lists, adding/removing products, and managing list metadata.
| Function | Description |
|---|---|
addProductsToRequisitionList | Adds products to a requisition list.. |
addRequisitionListItemsToCart | This function adds the chosen items from a requisition list to the logged-in user cart.. |
createRequisitionList | This function creates a new requisition list with the name and description provided for a logged-in user.. |
deleteRequisitionList | This function deletes a requisition list identified by uid.. |
deleteRequisitionListItems | Deletes items from a requisition list.. |
getProductData | API function for the drop-in.. |
getRequisitionList | This function returns information about the desired requisition list from a logged-in user,.. |
getRequisitionLists | This function returns the requisition lists from a logged-in user.. |
getStoreConfig | API function for the drop-in.. |
updateRequisitionList | This function updates an existing requisition list with the name and description provided for a logged-in user.. |
updateRequisitionListItems | This function updates the items of an existing requisition list with the quantity and options provided for a logged-in user.. |
addProductsToRequisitionList
Adds products to a requisition list.
const addProductsToRequisitionList = async ( requisitionListUid: string, requisitionListItems: Array<RequisitionListItemsInput>): Promise<RequisitionList | null>| Parameter | Type | Req? | Description |
|---|---|---|---|
requisitionListUid | string | Yes | The unique identifier for the requisition list to which products will be added. This UID is returned when creating or retrieving requisition lists. |
requisitionListItems | Array<RequisitionListItemsInput> | Yes | An array of product objects to add to the requisition list. Each object includes the product SKU, quantity, and optional configuration like parent SKU for configurable products, selected options (color, size), and entered options (custom text fields). |
Events
Emits the requisitionList/data event.
Returns
Returns RequisitionList or null.
addRequisitionListItemsToCart
This function adds the chosen items from a requisition list to the logged-in user cart.
const addRequisitionListItemsToCart = async ( requisitionListUid: string, requisitionListItemUids: Array<string>): Promise<Array<string> | null>| Parameter | Type | Req? | Description |
|---|---|---|---|
requisitionListUid | string | Yes | The unique identifier for the requisition list containing the items to add to the cart. |
requisitionListItemUids | Array<string> | Yes | An array of requisition list item UIDs to add to the cart. These are the unique identifiers for specific items within the list, not product SKUs. |
Events
Does not emit any drop-in events.
Returns
Returns Array<string> | null.
createRequisitionList
This function creates a new requisition list with the name and description provided for a logged-in user.
const createRequisitionList = async ( name: string, description?: string): Promise<RequisitionList | null>| Parameter | Type | Req? | Description |
|---|---|---|---|
name | string | Yes | The display name for the new requisition list. This helps users identify and organize their lists (e.g., **Office Supplies Q1**, **Weekly Inventory Restock**). |
description | string | No | An optional text description providing additional context about the requisition list’s purpose or contents (e.g., **Monthly recurring orders for maintenance supplies**). |
Events
Emits the requisitionList/data event.
Returns
Returns RequisitionList or null.
deleteRequisitionList
This function deletes a requisition list identified by uid.
const deleteRequisitionList = async ( requisitionListUid: string): Promise<{ items: RequisitionList[]; page_info: any; status: any;} | null>| Parameter | Type | Req? | Description |
|---|---|---|---|
requisitionListUid | string | Yes | The unique identifier for the requisition list to delete. This operation is permanent and removes the list and all its items. |
Events
Emits the requisitionLists/data event.
Returns
Promise<{ items: RequisitionList[]; page_info: any; status: any;} | null>See RequisitionList.
deleteRequisitionListItems
Deletes items from a requisition list.
const deleteRequisitionListItems = async ( requisitionListUid: string, items: Array<string>, pageSize: number, currentPage: number): Promise<RequisitionList | null>| Parameter | Type | Req? | Description |
|---|---|---|---|
requisitionListUid | string | Yes | The unique identifier for the requisition list from which items will be removed. |
items | Array<string> | Yes | An array of requisition list item UIDs to remove. These are the unique identifiers returned in the list’s items array, not product SKUs. |
pageSize | number | Yes | The number of items to return per page in the updated requisition list response. |
currentPage | number | Yes | The page number for pagination (1-indexed). Used to retrieve a specific page of items after deletion. |
Events
Emits the requisitionList/data event.
Returns
Returns RequisitionList or null.
getProductData
Signature
function getProductData(skus: string[]): Promise<Product[] | null>Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
skus | string[] | Yes | An array of product SKUs (stock keeping units) to retrieve product details for. Used to fetch product information including prices, stock status, and configuration options. |
getRequisitionList
This function returns information about the desired requisition list from a logged-in user,
const getRequisitionList = async ( requisitionListID: string, currentPage?: number, pageSize?: number): Promise<RequisitionList | null>| Parameter | Type | Req? | Description |
|---|---|---|---|
requisitionListID | string | Yes | The unique identifier for the requisition list to retrieve. Returns the list metadata and all items. |
currentPage | number | No | The page number for pagination (1-indexed). Defaults to page 1 if not specified. |
pageSize | number | No | The number of items to return per page. Controls pagination of the requisition list items. |
Events
Emits the requisitionList/data event.
Returns
Returns RequisitionList or null.
getRequisitionLists
This function returns the requisition lists from a logged-in user.
const getRequisitionLists = async ( currentPage?: number, pageSize?: number): Promise<RequisitionList[] | null>| Parameter | Type | Req? | Description |
|---|---|---|---|
currentPage | number | No | The page number for pagination (1-indexed). Used to navigate through multiple pages of requisition lists. |
pageSize | number | No | The number of requisition lists to return per page. Controls how many lists appear on each page. |
Events
Emits the requisitionLists/data event.
Returns
Returns an array of RequisitionList objects or null.
getStoreConfig
const getStoreConfig = async (): Promise<any>Events
Does not emit any drop-in events.
Returns
Returns void.
updateRequisitionList
This function updates an existing requisition list with the name and description provided for a logged-in user.
const updateRequisitionList = async ( requisitionListUid: string, name: string, description?: string, pageSize?: number, currentPage?: number): Promise<RequisitionList | null>| Parameter | Type | Req? | Description |
|---|---|---|---|
requisitionListUid | string | Yes | The unique identifier for the requisition list to update. |
name | string | Yes | The new display name for the requisition list. Updates the list’s title. |
description | string | No | The new text description for the requisition list. Updates the list’s purpose or context information. |
pageSize | number | No | The number of items to return per page in the updated requisition list response. |
currentPage | number | No | The page number for pagination (1-indexed) in the updated requisition list response. |
Events
Emits the requisitionList/data event.
Returns
Returns RequisitionList or null.
updateRequisitionListItems
This function updates the items of an existing requisition list with the quantity and options provided for a logged-in user.
const updateRequisitionListItems = async ( requisitionListUid: string, requisitionListItems: Array<UpdateRequisitionListItemsInput>, pageSize: number, currentPage: number): Promise<RequisitionList | null>| Parameter | Type | Req? | Description |
|---|---|---|---|
requisitionListUid | string | Yes | The unique identifier for the requisition list containing the items to update. |
requisitionListItems | Array<UpdateRequisitionListItemsInput> | Yes | An array of requisition list items to update. Each object includes the item UID and the fields to modify (such as quantity, selected options, or entered options). |
pageSize | number | Yes | The number of items to return per page in the updated requisition list response. |
currentPage | number | Yes | The page number for pagination (1-indexed) in the updated requisition list response. |
Events
Emits the requisitionList/data event.
Returns
Returns RequisitionList or null.
Data Models
The following data models are used by functions in this drop-in.
RequisitionList
The RequisitionList object is returned by the following functions: addProductsToRequisitionList, createRequisitionList, deleteRequisitionList, deleteRequisitionListItems, getRequisitionList, getRequisitionLists, updateRequisitionList, updateRequisitionListItems.
interface RequisitionList { uid: string; name: string; description: string; updated_at: string; items_count: number; items: Item[]; page_info?: PageInfo;}