@scayle/storefront-core
Version:
Collection of essential utilities to work with the Storefront API
23 lines (22 loc) • 917 B
TypeScript
import type { Order, OrderItem } from '../types';
/**
* Retrieves unique items from an order based on variant ID.
*
* @param order The order object.
*
* @returns An array of unique order items.
*
* @deprecated getting unique items from order should be handled within the Storefront project itself.
*/
export declare const getUniqueItemsFromOrder: <P, V>(order: Order<P, V>) => OrderItem<P, V>[] | undefined;
/**
* Gets the quantity of a specific item in an order based on its variant ID.
*
* @param order The order object.
* @param variantId The ID of the variant to count.
*
* @returns The quantity of the item in the order, or undefined if the order or items are undefined.
*
* @deprecated getting item quantity from order should be handled within the Storefront project itself.
*/
export declare const getItemQuantityFromOrder: <P, V>(order: Order<P, V>, variantId: number) => number | undefined;