> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

# Method name:

siteStores.getVariants(productId: string, options: ProductVariantOptions)

# Method Link:

https://dev.wix.com/docs/frontend-modules/frontend-modules/stores/product/get-variants.md

# Method Description:

Gets a product's available variants based on the specified product ID and either option choices or variant IDs.

# Method Permissions:



# Method Permissions Scopes IDs:

undefined



# Method Code Examples:

## Get product variants by specified choices

```javascript
import { product } from '@wix/site-stores';

const productId = "91f7ac8b-2baa-289c-aa50-6d64764f35d3";
const options = {
  choices: {
    "Weight": "500g"
  }
};

product.getVariants(productId, options)
  .then((variants) => {
    const firstVariant = variants[0];
    const firstPrice = firstVariant.variant.price;
    const numberOfReturnedVariants = variants.length;
  })
  .catch((error) => {
    console.error(error);
  });


/*
 * Example of returned variants:
 *
 *  [
 *    {
 *      "_id": "00000000-0000-003f-0005-a316e6ba5b37",
 *      "choices": {
 *        "Weight": "500g",
 *        "Ground for": "Stovetop"
 *      },
 *      "variant": {
 *        "currency": "USD",
 *        "price": 65,
 *        "discountedPrice": 60,
 *        "pricePerUnit": 0.24,
 *        "formattedPrice": "$65.00",
 *        "formattedDiscountedPrice": "$65.00",
 *        "formattedPricePerUnit": "$0.24",
 *        "weight": 0.5,
 *        "sku": "10002",
 *        "visible": true
 *      }
 *    },
 *    {
 *      "_id": "00000000-0000-0040-0005-a316e6ba5b37",
 *      "choices": {
 *        "Weight": "500g",
 *        "Ground for": "Filter"
 *      },
 *      "variant": {
 *        "currency": "USD",
 *        "price": 70,
 *        "discountedPrice": 65,
 *        "pricePerUnit": 0.26,
 *        "formattedPrice": "$70.00",
 *        "formattedDiscountedPrice": "$70.00",
 *        "formattedPricePerUnit": "$0.26",
 *        "weight": 1,
 *        "sku": "10004",
 *        "visible": true
 *      }
 *    }
 *  ]
 *
 */
```

## Get product variants by variant IDs

```javascript
import { product } from '@wix/site-stores';

const productId = "91f7ac8b-2baa-289c-aa50-6d64764f35d3";
const options = {
  variantIds: [
    "00000000-0000-0020-0005-a316e6ba5b37",
    "00000000-0000-003f-0005-a316e6ba5b37"
  ]
};

product.getVariants(productId, options)
  .then((variants) => {
    const firstVariant = variants[0];
    const firstPrice = firstVariant.variant.price;
    const numberOfReturnedVariants = variants.length;
  })
  .catch((error) => {
    console.error(error);
  })


/*
 * Example of returned variants array:
 *
 *  [
 *    {
 *      "_id": "00000000-0000-0020-0005-a316e6ba5b37",
 *      "choices": {
 *        "Weight": "250g",
 *        "Ground for": "Stovetop"
 *      },
 *      "variant": {
 *        "currency": "USD",
 *        "price": 35,
 *        "discountedPrice": 30,
 *        "pricePerUnit": 0.12,
 *        "formattedPrice": "$35.00",
 *        "formattedDiscountedPrice": "$35.00",
 *        "formattedPricePerUnit": "$0.12",
 *        "weight": 0.25,
 *        "sku": "10001",
 *        "visible": true
 *      }
 *    },
 *    {
 *      "_id": "00000000-0000-003f-0005-a316e6ba5b37",
 *      "choices": {
 *        "Weight": "500g",
 *        "Ground for": "Stovetop"
 *      },
 *      "variant": {
 *        "currency": "USD",
 *        "price": 65,
 *        "discountedPrice": 60,
 *        "pricePerUnit": 0.24,
 *        "formattedPrice": "$65.00",
 *        "formattedDiscountedPrice": "$65.00",
 *        "formattedPricePerUnit": "$0.24",
 *        "weight": 0.5,
 *        "sku": "10002",
 *        "visible": true
 *      }
 *    }
 *  ]
 *
 */
```