# Product variations

You can retrieve [product variations](https://docs.digitalriver.com/commerce-api-references/commerce-api-reference-guide/admin-apis-reference/products#product-variations) programmatically.

Offering customers various options to suit their preferences and needs is crucial when selling products online. Product variations allow you to provide multiple product versions, differing in attributes such as size, color, or style. By accessing product variations programmatically through the API, you can streamline the management and display of these options, enhancing the shopping experience.

## Getting product variations

To get product variations, you can send a [`GET /v1/shoppers/me/products/{productId}/variations`](https://docs.digitalriver.com/commerce-api-references/shopper-apis/browse-product-discovery/product-variations#v1-shoppers-me-products-productid-variations) request, providing the `productId` for the desired product. Replace `{Your_Access_Token}` with your [access token](/commerce-api/shopper-apis/oauth/access-tokens.md). This request retrieves all variations for the specified product. Here's an example using cURL:

{% tabs %}
{% tab title="cURL" %}

```http
curl --location --request GET 'https://api.digitalriver.com/v1/shoppers/me/products/{productId}/variations \
--header 'authorization: bearer {Your_Access_token}\
...
```

{% endtab %}

{% tab title="200 OK response" %}

```json
{
  "variations": {
    "uri": "https://api.digitalriver.com/v1/shoppers/me/products/64358200/variations",
    "product": [
      {
        "uri": "https://api.digitalriver.com/v1/shoppers/me/products/64578500",
        "displayName": "Class I",
        "thumbnailImage": "https://drh-sys-ora.img.digitalriver.com/Storefront/Company/demosft1/images/product/thumbnail/classIThumb.jpg",
        "pricing": {
          "uri": "https://api.digitalriver.com/v1/shoppers/me/products/64578500/pricing",
          "formattedListPrice": "$19.99",
          "formattedSalePriceWithQuantity": "$17.99"
        },
        "addProductToCart": {
          "uri": "https://api.digitalriver.com/v1/shoppers/me/carts/active/line-items?productId=64578500",
          "cartUri": "https://api.digitalriver.com/v1/shoppers/me/carts/active?productId=64578500"
        }
      }
    ]
  }
}
```

{% endtab %}
{% endtabs %}

A `200 OK` response provides details of the product variations, including pricing and options for adding the product to the cart.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.digitalriver.com/commerce-api/shopper-apis/product-discovery/product-variations.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
