--- title: useProducts description: >- The `useProducts` hook efficiently fetches multiple products in a single batched request. Takes an array of product IDs and returns complete product data. Ideal for product grids, carousels, or any UI displaying multiple products. All products share a single query cache entry, making this more efficient than multiple `useProduct()` calls. The entire query refetches if any ID in the array changes. api_name: shop-minis source_url: html: 'https://shopify.dev/docs/api/shop-minis/hooks/product/useproducts' md: 'https://shopify.dev/docs/api/shop-minis/hooks/product/useproducts.md' --- # use​Products The `useProducts` hook efficiently fetches multiple products in a single batched request. Takes an array of product IDs and returns complete product data. Ideal for product grids, carousels, or any UI displaying multiple products. All products share a single query cache entry, making this more efficient than multiple `useProduct()` calls. The entire query refetches if any ID in the array changes. ## use​Products([params](#-propertydetail-params)​) ### Parameters * params UseProductsParams required ### Returns * UseProductsReturns ### UseProductsReturns * error Error | null * loading boolean * products Product\[] | null The products returned from the query. * refetch () => Promise\ ### UseProductsParams * fetchPolicy ```ts DataHookFetchPolicy ``` * ids The product IDs to fetch. ```ts string[] ``` * skip ```ts boolean ``` ```ts export interface UseProductsParams extends DataHookOptionsBase { /** * The product IDs to fetch. */ ids: string[] } ``` ### DataHookFetchPolicy ```ts 'cache-first' | 'network-only' ``` ### UseProductsReturns * error ```ts Error | null ``` * loading ```ts boolean ``` * products The products returned from the query. ```ts Product[] | null ``` * refetch ```ts () => Promise ``` ```ts interface UseProductsReturns extends DataHookReturnsBase { /** * The products returned from the query. */ products: Product[] | null } ``` ### Product * compareAtPrice ```ts Money | null ``` * defaultVariantId ```ts string ``` * featuredImage ```ts ProductImage | null ``` * id ```ts string ``` * isFavorited ```ts boolean ``` * price ```ts Money ``` * referral ```ts boolean ``` * reviewAnalytics ```ts { averageRating?: number; reviewCount?: number; } ``` * selectedVariant ```ts ProductVariant ``` * shop ```ts ProductShop ``` * title ```ts string ``` * variants ```ts ProductVariant[] ``` ```ts export interface Product { id: string title: string reviewAnalytics: { averageRating?: number | null reviewCount?: number | null } shop: ProductShop selectedVariant?: ProductVariant defaultVariantId: string isFavorited: boolean variants?: ProductVariant[] featuredImage?: ProductImage | null price: Money compareAtPrice?: Money | null referral?: boolean } ``` ### Money * amount ```ts Decimal ``` * currencyCode ```ts CurrencyCode ``` ```ts export interface Money { amount: Decimal currencyCode: CurrencyCode } ``` ### Decimal ```ts string ``` ### CurrencyCode ```ts 'AED' | 'AFN' | 'ALL' | 'AMD' | 'ANG' | 'AOA' | 'ARS' | 'AUD' | 'AWG' | 'AZN' | 'BAM' | 'BBD' | 'BDT' | 'BGN' | 'BHD' | 'BIF' | 'BMD' | 'BND' | 'BOB' | 'BRL' | 'BSD' | 'BTN' | 'BWP' | 'BYN' | 'BYR' | 'BZD' | 'CAD' | 'CDF' | 'CHF' | 'CLP' | 'CNY' | 'COP' | 'CRC' | 'CVE' | 'CZK' | 'DJF' | 'DKK' | 'DOP' | 'DZD' | 'EGP' | 'ERN' | 'ETB' | 'EUR' | 'FJD' | 'FKP' | 'GBP' | 'GEL' | 'GHS' | 'GIP' | 'GMD' | 'GNF' | 'GTQ' | 'GYD' | 'HKD' | 'HNL' | 'HRK' | 'HTG' | 'HUF' | 'IDR' | 'ILS' | 'INR' | 'IQD' | 'IRR' | 'ISK' | 'JEP' | 'JMD' | 'JOD' | 'JPY' | 'KES' | 'KGS' | 'KHR' | 'KID' | 'KMF' | 'KRW' | 'KWD' | 'KYD' | 'KZT' | 'LAK' | 'LBP' | 'LKR' | 'LRD' | 'LSL' | 'LTL' | 'LVL' | 'LYD' | 'MAD' | 'MDL' | 'MGA' | 'MKD' | 'MMK' | 'MNT' | 'MOP' | 'MRU' | 'MUR' | 'MVR' | 'MWK' | 'MXN' | 'MYR' | 'MZN' | 'NAD' | 'NGN' | 'NIO' | 'NOK' | 'NPR' | 'NZD' | 'OMR' | 'PAB' | 'PEN' | 'PGK' | 'PHP' | 'PKR' | 'PLN' | 'PYG' | 'QAR' | 'RON' | 'RSD' | 'RUB' | 'RWF' | 'SAR' | 'SBD' | 'SCR' | 'SDG' | 'SEK' | 'SGD' | 'SHP' | 'SLL' | 'SOS' | 'SRD' | 'SSP' | 'STD' | 'STN' | 'SYP' | 'SZL' | 'THB' | 'TJS' | 'TMT' | 'TND' | 'TOP' | 'TRY' | 'TTD' | 'TWD' | 'TZS' | 'UAH' | 'UGX' | 'USD' | 'UYU' | 'UZS' | 'VED' | 'VEF' | 'VES' | 'VND' | 'VUV' | 'WST' | 'XAF' | 'XCD' | 'XOF' | 'XPF' | 'XXX' | 'YER' | 'ZAR' | 'ZMW' ``` ### ProductImage * altText ```ts string | null ``` * height ```ts number | null ``` * id ```ts string | null ``` * sensitive ```ts boolean | null ``` * thumbhash ```ts string | null ``` * url ```ts string ``` * width ```ts number | null ``` ```ts export interface ProductImage { id?: string | null altText?: string | null url: string width?: number | null height?: number | null /** * @deprecated This property will be removed in a future version */ sensitive?: boolean | null thumbhash?: string | null } ``` ### ProductVariant * compareAtPrice ```ts Money | null ``` * id ```ts string ``` * image ```ts ProductImage | null ``` * isFavorited ```ts boolean ``` * price ```ts Money ``` * title ```ts string ``` ```ts export interface ProductVariant { id: string title: string isFavorited: boolean image?: ProductImage | null price: Money compareAtPrice?: Money | null } ``` ### ProductShop * id ```ts string ``` * name ```ts string ``` ```ts export interface ProductShop { id: string name: string } ``` Examples ### Examples * #### Example code ##### Default ```tsx import {useProducts} from '@shopify/shop-minis-react' export default function MyComponent() { const {products, loading, error} = useProducts({ ids: [ 'gid://shopify/Product/123', 'gid://shopify/Product/456', 'gid://shopify/Product/789', ], }) console.log({products, loading, error}) } ```