Skip to content

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

RequisitionListView Container

Displays the contents of a specific requisition list, including items, quantities, and management actions. Provides functionality to view products, update quantities, delete items, add items to cart, and manage the requisition list itself.

RequisitionListView container

RequisitionListView container
Version: 1.1.0

The RequisitionListView container provides the following configuration options:

ParameterTypeReq?Description
requisitionListUidstringYesSpecifies the UID of the requisition list to display. Must be a base64-encoded string. If an invalid UID is provided, renders the NotFound state. Fetches the requisition list data internally using this identifier.
skipProductLoadingbooleanNoControls whether to skip automatic product data fetching on component mount. Set to true in test environments to prevent API calls or when product data is loaded externally.
pageSizenumberNoSets the number of items displayed per page for pagination. Controls how many requisition list items appear in each page view. Defaults to DEFAULT_PAGE_SIZE if not specified.
selectedItemsSet<string>YesProvides a Set of selected item UIDs for batch operations. Tracks which items are selected for actions like adding to cart or deleting. Required to enable multi-select functionality.
routeRequisitionListGridfunctionNoGenerates the URL for navigating back to the requisition list grid view. Use to implement breadcrumb navigation, back buttons, or custom routing logic that preserves query parameters or application state.
fallbackRoutestringNoSets the fallback URL to redirect when requisition lists are not enabled or unavailable. Defaults to ‘/customer/account’. Use to provide graceful degradation when B2B features are disabled.
getProductData(skus: string[]) => Promise<Product[] | null>YesFetches products by SKU from the catalog service. Takes an array of SKUs and returns an array of products with all their data.
enrichConfigurableProducts(items: Item[]) => Promise<Item[]>YesEnriches the configurable products contained in requisition list items. Takes an array of items and returns the same array with configured product data attached.

This container does not expose any customizable slots.

The following example demonstrates how to use the RequisitionListView container with the required getProductData and enrichConfigurableProducts props:

import { render as provider } from '@dropins/storefront-requisition-list/render.js';
import RequisitionListView from '@dropins/storefront-requisition-list/containers/RequisitionListView.js';
import {
getProductData as pdpGetProductData,
getRefinedProduct as pdpGetRefinedProduct,
} from '@dropins/storefront-pdp/api.js';
const selectedItems = new Set();
/**
* Normalizes a product object into the shape expected by the requisition list UI:
* url, urlKey, images[].url, and price (final.amount.{ value, currency }).
* Handles multiple PDP response shapes (GraphQL, transformed prices, priceRange).
*
* @param {Object} product - Raw product from PDP (getProductData / getRefinedProduct).
* @returns {Object} Product with normalized url, urlKey, images, price; or original if null.
*/
function ensureProductShape(product) {
if (!product) return product;
const url = product.url ?? product.canonicalUrl ?? '';
const urlKey = product.urlKey ?? product.url_key ?? '';
const images = Array.isArray(product.images)
? product.images.map((img) => ({
url: img?.url ?? '',
label: img?.label ?? '',
roles: Array.isArray(img?.roles) ? img.roles : [],
}))
: [];
let { price } = product;
const { final: priceFinal } = price || {};
const { amount: amt } = priceFinal || {};
if (amt != null && typeof amt === 'object' && 'value' in amt) {
// Already in GraphQL shape; no change
} else if (amt != null && typeof amt === 'number') {
price = { final: { amount: { value: amt, currency: priceFinal?.currency ?? '' } } };
} else if (product.prices?.final != null) {
const { final: pf, regular: pr } = product.prices;
const regularAmount = pr != null
? { amount: { value: pr.amount ?? 0, currency: pr.currency ?? '' } }
: undefined;
price = {
final: { amount: { value: pf.amount ?? 0, currency: pf.currency ?? '' } },
regular: regularAmount,
};
} else if (product.priceRange?.minimum?.final?.amount != null) {
price = {
final: { amount: product.priceRange.minimum.final.amount },
regular: product.priceRange.minimum.regular,
};
}
return {
...product,
url,
urlKey,
images,
...(price != null && { price }),
};
}
/**
* Fetches products by SKU and normalizes them for the requisition list.
* PDP exposes getProductData(sku) → single product; this adapts it to
* getProductData(skus) → products[] and is passed as a required prop to RequisitionListView.
*
* @param {string[]} skus - Product SKUs to fetch.
* @returns {Promise<Object[]>} Resolved array of normalized products (falsy results omitted).
*/
const getProductData = async (skus) => {
const results = await Promise.all(skus.map((sku) => pdpGetProductData(sku)));
return results.filter(Boolean).map(ensureProductShape);
};
/**
* Enriches requisition list line items that have configurable options by resolving
* the configured variant via PDP getRefinedProduct and attaching it as configured_product.
*
* @param {Object[]} items - Requisition list items (each with product, configurable_options).
* @returns {Promise<Object[]>} Same items with configured_product set where resolution succeeds.
*/
const enrichConfigurableProducts = async (items) => {
if (!items?.length) return items;
return Promise.all(
items.map(async (item) => {
const { product, configurable_options: opts } = item;
if (!product?.sku || !opts?.length) return item;
const optionIds = opts.map((o) => {
const optionUid = o.option_uid ?? o.configurable_product_option_uid;
const valueUid = o.value_uid ?? o.configurable_product_option_value_uid;
return btoa(`configurable/${atob(optionUid)}/${atob(valueUid)}`);
});
try {
const configured = await pdpGetRefinedProduct(product.sku, optionIds);
if (!configured) return item;
const images = Array.isArray(configured.images)
? configured.images.map((img) => ({ url: img?.url ?? '' }))
: [];
return { ...item, configured_product: { ...configured, images } };
} catch {
return item;
}
}),
);
};
await provider.render(RequisitionListView, {
requisitionListUid: 'MQ==',
selectedItems,
pageSize: 20,
routeRequisitionListGrid: () => '/requisition-lists',
getProductData,
enrichConfigurableProducts,
})(block);
  • Display all items in a requisition list
  • Update item quantities
  • Delete individual items or multiple items (batch delete)
  • Add items to cart (individual or batch)
  • Rename the requisition list
  • Delete the entire requisition list
  • Pagination support for large numbers of items
  • Empty state when the requisition list has no items
  • Not found state when the requisition list doesn’t exist or is inaccessible
  • Product data loading and display