Skip to content

Search is only available in production builds. Try building and previewing the site to test it out locally.

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.

Version: 1.0.0-beta4
FunctionDescription
addProductsToRequisitionListAdds products to a requisition list..
addRequisitionListItemsToCartThis function adds the chosen items from a requisition list to the logged-in user cart..
createRequisitionListThis function creates a new requisition list with the name and description provided for a logged-in user..
deleteRequisitionListThis function deletes a requisition list identified by uid..
deleteRequisitionListItemsDeletes items from a requisition list..
getProductDataAPI function for the drop-in..
getRequisitionListThis function returns information about the desired requisition list from a logged-in user,..
getRequisitionListsThis function returns the requisition lists from a logged-in user..
getStoreConfigAPI function for the drop-in..
updateRequisitionListThis function updates an existing requisition list with the name and description provided for a logged-in user..
updateRequisitionListItemsThis 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>
ParameterTypeReq?Description
requisitionListUidstringYesThe unique identifier for the requisition list to which products will be added. This UID is returned when creating or retrieving requisition lists.
requisitionListItemsArray<RequisitionListItemsInput>YesAn 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>
ParameterTypeReq?Description
requisitionListUidstringYesThe unique identifier for the requisition list containing the items to add to the cart.
requisitionListItemUidsArray<string>YesAn 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>
ParameterTypeReq?Description
namestringYesThe display name for the new requisition list. This helps users identify and organize their lists (e.g., **Office Supplies Q1**, **Weekly Inventory Restock**).
descriptionstringNoAn 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>
ParameterTypeReq?Description
requisitionListUidstringYesThe 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>
ParameterTypeReq?Description
requisitionListUidstringYesThe unique identifier for the requisition list from which items will be removed.
itemsArray<string>YesAn array of requisition list item UIDs to remove. These are the unique identifiers returned in the list’s items array, not product SKUs.
pageSizenumberYesThe number of items to return per page in the updated requisition list response.
currentPagenumberYesThe 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

ParameterTypeRequiredDescription
skusstring[]YesAn 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>
ParameterTypeReq?Description
requisitionListIDstringYesThe unique identifier for the requisition list to retrieve. Returns the list metadata and all items.
currentPagenumberNoThe page number for pagination (1-indexed). Defaults to page 1 if not specified.
pageSizenumberNoThe 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>
ParameterTypeReq?Description
currentPagenumberNoThe page number for pagination (1-indexed). Used to navigate through multiple pages of requisition lists.
pageSizenumberNoThe 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>
ParameterTypeReq?Description
requisitionListUidstringYesThe unique identifier for the requisition list to update.
namestringYesThe new display name for the requisition list. Updates the list’s title.
descriptionstringNoThe new text description for the requisition list. Updates the list’s purpose or context information.
pageSizenumberNoThe number of items to return per page in the updated requisition list response.
currentPagenumberNoThe 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>
ParameterTypeReq?Description
requisitionListUidstringYesThe unique identifier for the requisition list containing the items to update.
requisitionListItemsArray<UpdateRequisitionListItemsInput>YesAn 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).
pageSizenumberYesThe number of items to return per page in the updated requisition list response.
currentPagenumberYesThe 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;
}