--- title: useProductVariants description: The `useProductVariants` hook fetches product variants for a specific product. api_name: shop-minis source_url: html: 'https://shopify.dev/docs/api/shop-minis/hooks/product/useproductvariants' md: 'https://shopify.dev/docs/api/shop-minis/hooks/product/useproductvariants.md' --- # use​Product​Variants The `useProductVariants` hook fetches product variants for a specific product. ## use​Product​Variants([params](#-propertydetail-params)​) ### Parameters * params UseProductVariantsParams required ### Returns * UseProductVariantsReturns ### UseProductVariantsReturns * error Error | null * fetchMore () => Promise\ * hasNextPage boolean * loading boolean * refetch () => Promise\ * variants ProductVariant\[] | null The product variants returned from the query. ### UseProductVariantsParams * fetchPolicy ```ts DataHookFetchPolicy ``` * first ```ts number ``` * id The product ID to fetch variants for. ```ts string ``` * skip ```ts boolean ``` ```ts export interface UseProductVariantsParams extends PaginatedDataHookOptionsBase { /** * The product ID to fetch variants for. */ id: string } ``` ### DataHookFetchPolicy ```ts 'cache-first' | 'network-only' ``` ### UseProductVariantsReturns * error ```ts Error | null ``` * fetchMore ```ts () => Promise ``` * hasNextPage ```ts boolean ``` * loading ```ts boolean ``` * refetch ```ts () => Promise ``` * variants The product variants returned from the query. ```ts ProductVariant[] | null ``` ```ts interface UseProductVariantsReturns extends PaginatedDataHookReturnsBase { /** * The product variants returned from the query. */ variants: ProductVariant[] | 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 } ``` ### 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 } ``` Examples ### Examples * #### Example code ##### Default ```tsx import {useProductVariants, Button} from '@shopify/shop-minis-react' export default function MyComponent() { const {variants, loading, error, hasNextPage, loadMore} = useProductVariants({ id: 'gid://shopify/Product/123', first: 10, }) console.log({variants, loading, error}) return ( <> {/* Render variants here */} {hasNextPage && ( )} ) } ```