> For the complete documentation index, see [llms.txt](https://rymera.gitbook.io/wholesale-suite-api/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://rymera.gitbook.io/wholesale-suite-api/wholesale-v1-wwp/variations/list-all-wholesale-variations.md).

# List All Wholesale Variations

This API handles fetching wholesale and non-wholesale variations.

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

| Method | Endpoint                                                 |
| ------ | -------------------------------------------------------- |
| GET    | /wp-json/wholesale/v1/products/{variable\_id}/variations |

| Path parameters | Required | Type | Description      |
| --------------- | -------- | ---- | ---------------- |
| variable\_id    | yes      | int  | The variable ID. |

| Query Parameters            | Required | Type    | Description                                                                                                                       |
| --------------------------- | -------- | ------- | --------------------------------------------------------------------------------------------------------------------------------- |
| wholesale\_role             | no       | string  | The wholesale role key.                                                                                                           |
| return\_wholesale\_products | no       | boolean | Return only products with wholesale price. This parameter is dependent on the `wholesale_role` parameter. Default value is false. |
| {% endtab %}                |          |         |                                                                                                                                   |

{% tab title="Request Example" %}

#### Postman

List all variations without filter

```javascript
GET: /wp-json/wholesale/v1/products/{variable_id}/variations
```

List wholesale variations for wholesale customer

```javascript
GET: /wp-json/wholesale/v1/products/{variable_id}/variations?wholesale_role=wholesale_customer&return_wholesale_products=true
```

{% endtab %}

{% tab title="Response Example" %}

#### Status: 200 OK

List all wholesale variations.

```
GET: /wp-json/wholesale/v1/products/{variable_id}/variations?wholesale_role=wholesale_customer&return_wholesale_products=true

Response:
[
    {
        "id": 4302,
        "date_created": "2021-03-15T05:16:57",
        "date_created_gmt": "2021-03-15T05:16:57",
        "date_modified": "2021-03-15T05:19:06",
        "date_modified_gmt": "2021-03-15T05:19:06",
        "description": "",
        "permalink": "https://example.com/product/wholesale-variable/?attribute_pa_color=gold",
        "sku": "",
        "price": "100",
        "regular_price": "100",
        "sale_price": "",
        "date_on_sale_from": null,
        "date_on_sale_from_gmt": null,
        "date_on_sale_to": null,
        "date_on_sale_to_gmt": null,
        "on_sale": false,
        "status": "publish",
        "purchasable": true,
        "virtual": false,
        "downloadable": false,
        "downloads": [],
        "download_limit": -1,
        "download_expiry": -1,
        "tax_status": "taxable",
        "tax_class": "",
        "manage_stock": false,
        "stock_quantity": null,
        "stock_status": "instock",
        "backorders": "no",
        "backorders_allowed": false,
        "backordered": false,
        "weight": "",
        "dimensions": {
            "length": "",
            "width": "",
            "height": ""
        },
        "shipping_class": "",
        "shipping_class_id": 0,
        "image": null,
        "attributes": [
            {
                "id": 1,
                "name": "Color",
                "option": "Gold"
            }
        ],
        "menu_order": 3,
        "wholesale_data": {
            "wholesale_price": {
                "wholesale_customer": "80"
            },
            "price_html": "<del class=\"original-computed-price\"><span class=\"woocommerce-Price-amount amount\"><bdi><span class=\"woocommerce-Price-currencySymbol\">&#36;</span>100.00</bdi></span></del><span style=\"display: block;\" class=\"wholesale_price_container\">\r\n                                            <span class=\"wholesale_price_title\">Wholesale Price:</span>\r\n                                            <ins><span class=\"woocommerce-Price-amount amount\"><bdi><span class=\"woocommerce-Price-currencySymbol\">&#36;</span>80.00</bdi></span> <small class=\"woocommerce-price-suffix wholesale-price-suffix\"></small></ins>\r\n                                        </span>"
        }
    },
    {
        "id": 4301,
        "date_created": "2021-03-15T05:16:57",
        "date_created_gmt": "2021-03-15T05:16:57",
        "date_modified": "2021-03-15T05:19:06",
        "date_modified_gmt": "2021-03-15T05:19:06",
        "description": "",
        "permalink": "https://example.com/product/wholesale-variable/?attribute_pa_color=blue",
        "sku": "",
        "price": "100",
        "regular_price": "100",
        "sale_price": "",
        "date_on_sale_from": null,
        "date_on_sale_from_gmt": null,
        "date_on_sale_to": null,
        "date_on_sale_to_gmt": null,
        "on_sale": false,
        "status": "publish",
        "purchasable": true,
        "virtual": false,
        "downloadable": false,
        "downloads": [],
        "download_limit": -1,
        "download_expiry": -1,
        "tax_status": "taxable",
        "tax_class": "",
        "manage_stock": false,
        "stock_quantity": null,
        "stock_status": "instock",
        "backorders": "no",
        "backorders_allowed": false,
        "backordered": false,
        "weight": "",
        "dimensions": {
            "length": "",
            "width": "",
            "height": ""
        },
        "shipping_class": "",
        "shipping_class_id": 0,
        "image": null,
        "attributes": [
            {
                "id": 1,
                "name": "Color",
                "option": "Blue"
            }
        ],
        "menu_order": 2,
        "wholesale_data": {
            "wholesale_price": {
                "wholesale_customer": "80"
            },
            "price_html": "<del class=\"original-computed-price\"><span class=\"woocommerce-Price-amount amount\"><bdi><span class=\"woocommerce-Price-currencySymbol\">&#36;</span>100.00</bdi></span></del><span style=\"display: block;\" class=\"wholesale_price_container\">\r\n                                            <span class=\"wholesale_price_title\">Wholesale Price:</span>\r\n                                            <ins><span class=\"woocommerce-Price-amount amount\"><bdi><span class=\"woocommerce-Price-currencySymbol\">&#36;</span>80.00</bdi></span> <small class=\"woocommerce-price-suffix wholesale-price-suffix\"></small></ins>\r\n                                        </span>"
        }
    },
    {
        "id": 4300,
        "date_created": "2021-03-15T05:16:57",
        "date_created_gmt": "2021-03-15T05:16:57",
        "date_modified": "2021-03-15T05:19:06",
        "date_modified_gmt": "2021-03-15T05:19:06",
        "description": "",
        "permalink": "https://example.com/product/wholesale-variable/?attribute_pa_color=black",
        "sku": "",
        "price": "100",
        "regular_price": "100",
        "sale_price": "",
        "date_on_sale_from": null,
        "date_on_sale_from_gmt": null,
        "date_on_sale_to": null,
        "date_on_sale_to_gmt": null,
        "on_sale": false,
        "status": "publish",
        "purchasable": true,
        "virtual": false,
        "downloadable": false,
        "downloads": [],
        "download_limit": -1,
        "download_expiry": -1,
        "tax_status": "taxable",
        "tax_class": "",
        "manage_stock": false,
        "stock_quantity": null,
        "stock_status": "instock",
        "backorders": "no",
        "backorders_allowed": false,
        "backordered": false,
        "weight": "",
        "dimensions": {
            "length": "",
            "width": "",
            "height": ""
        },
        "shipping_class": "",
        "shipping_class_id": 0,
        "image": null,
        "attributes": [
            {
                "id": 1,
                "name": "Color",
                "option": "Black"
            }
        ],
        "menu_order": 1,
        "wholesale_data": {
            "wholesale_price": {
                "wholesale_customer": "80"
            },
            "price_html": "<del class=\"original-computed-price\"><span class=\"woocommerce-Price-amount amount\"><bdi><span class=\"woocommerce-Price-currencySymbol\">&#36;</span>100.00</bdi></span></del><span style=\"display: block;\" class=\"wholesale_price_container\">\r\n                                            <span class=\"wholesale_price_title\">Wholesale Price:</span>\r\n                                            <ins><span class=\"woocommerce-Price-amount amount\"><bdi><span class=\"woocommerce-Price-currencySymbol\">&#36;</span>80.00</bdi></span> <small class=\"woocommerce-price-suffix wholesale-price-suffix\"></small></ins>\r\n                                        </span>"
        }
    }
]
```

####

#### Status: 400 Bad Request

The wholesale role key is invalid

```
GET: /wp-json/wholesale/v1/products/{variation_id}/variations?wholesale_role=invalid_role

Response:
{
    "code": "wholesale_rest_product_cannot_view",
    "message": "Invalid wholesale role.",
    "data": {
        "status": 400
    }
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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://rymera.gitbook.io/wholesale-suite-api/wholesale-v1-wwp/variations/list-all-wholesale-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.
