# Update a Wholesale Role

This API allows you to update wholesale role.

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

| PUT | /wp-json/wholesale/v1/roles/{role\_key} |
| --- | --------------------------------------- |

| Path Parameters |          |        |                                   |
| --------------- | -------- | ------ | --------------------------------- |
| role\_key       | required | string | Wholesale Role Key to be updated. |

| Body Parameters                   | Type   | Required | Description                                                               |
| --------------------------------- | ------ | -------- | ------------------------------------------------------------------------- |
| role\_key                         | string | no       | Wholesale Role key.                                                       |
| role\_name                        | string | no       | Wholesale Role name.                                                      |
| description                       | string | no       | Wholesale Role description.                                               |
| shipping\_class\_name             | string | no       | Shipping class name.                                                      |
| shipping\_class\_term\_id         | int    | no       | Shipping term ID.                                                         |
| only\_allow\_wholesale\_purchases | string | no       | Only allow wholesale purchases for this specific role. Should be "yes" or |
| {% endtab %}                      |        |          |                                                                           |

{% tab title="Request Example" %}

#### Postman:

Update a wholesale role

```javascript
PUT: /wp-json/wholesale/v1/roles/sample_role

JSON Body:
{
    "role_name" : "New Sample Role",
    "description" : "Sample description updated",
    "shipping_class_name" : "",
    "shipping_class_term_id" : "",
    "only_allow_wholesale_purchases" : "yes"
}
```

{% endtab %}

{% tab title="Response Example" %}

#### Status: 200 OK

```
{
    "message": "Wholesale Role \"sample_role\" has been updated.",
    "data": {
        "sample_role": {
            "roleName": "Sample Role Updated",
            "desc": "Sample description updated",
            "shippingClassName": "",
            "shippingClassTermId": "",
            "onlyAllowWholesalePurchases": "yes"
        }
    }
}
```

{% endtab %}
{% endtabs %}


---

# 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://rymera.gitbook.io/wholesale-suite-api/wholesale-v1-wwpp/wholesale-role/update-a-wholesale-role.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.
