--- title: getSelectedProductOptions description: >- The `getSelectedProductOptions` returns the selected options from the Request search parameters. The selected options can then be easily passed to your GraphQL query with [`variantBySelectedOptions`](https://shopify.dev/docs/api/storefront/2023-07/objects/product#field-product-variantbyselectedoptions). api_version: 2023-07 api_name: hydrogen source_url: html: >- https://shopify.dev/docs/api/hydrogen/2023-07/utilities/getselectedproductoptions md: >- https://shopify.dev/docs/api/hydrogen/2023-07/utilities/getselectedproductoptions.md --- # get​Selected​Product​Options The `getSelectedProductOptions` returns the selected options from the Request search parameters. The selected options can then be easily passed to your GraphQL query with [`variantBySelectedOptions`](https://shopify.dev/docs/api/storefront/2023-07/objects/product#field-product-variantbyselectedoptions). ## Props([request](#props-propertydetail-request)​) ### Parameters * request Request required ### Returns * SelectedOptionInput\[] ### Examples * #### Example code ##### Description I am the default example ##### JavaScript ```jsx import {getSelectedProductOptions} from '@shopify/hydrogen'; import {json} from '@shopify/remix-oxygen'; export async function loader({request, params, context}) { const selectedOptions = getSelectedProductOptions(request); const {product} = await context.storefront.query(PRODUCT_QUERY, { variables: { handle: params.productHandle, selectedOptions, }, }); return json({product}); } const PRODUCT_QUERY = `#graphql query Product($handle: String!, $selectedOptions: [SelectedOptionInput!]!) { product(handle: $handle) { title description options { name values } selectedVariant: variantBySelectedOptions(selectedOptions: $selectedOptions) { ...ProductVariantFragment } } } `; ``` ##### TypeScript ```tsx import {getSelectedProductOptions} from '@shopify/hydrogen'; import {json, type LoaderArgs} from '@shopify/remix-oxygen'; export async function loader({request, params, context}: LoaderArgs) { const selectedOptions = getSelectedProductOptions(request); const {product} = await context.storefront.query(PRODUCT_QUERY, { variables: { handle: params.productHandle, selectedOptions, }, }); return json({product}); } const PRODUCT_QUERY = `#graphql query Product($handle: String!, $selectedOptions: [SelectedOptionInput!]!) { product(handle: $handle) { title description options { name values } selectedVariant: variantBySelectedOptions(selectedOptions: $selectedOptions) { ...ProductVariantFragment } } } `; ``` ## Related [- VariantSelector](https://shopify.dev/docs/api/hydrogen/2023-07/components/variantselector)