Contents
Get Role Prices - Plugixa Multi Currency for WooCommerce
GET /plugixa-multi-currency/v1/pro/role-prices
The Prices by user role tab. See Prices by user role.
Needs a user with the plugixa_multi_currency_manage_settings capability (signed in with an Application Password, or the login cookie with an X-WP-Nonce header). Administrators hold it; see Capabilities.
Note. Pro only: on the free plugin this route answers
404rest_no_route.
Request
GET https://your-store.example/wp-json/plugixa-multi-currency/v1/pro/role-prices
Responses
200 OK.
{
"success": true,
"data": {
"rules": [
{
"role": "wholesale_customer",
"currency": "*",
"percent": "-20"
},
{
"role": "b2b_customer",
"currency": "EUR",
"percent": "-15"
}
],
"roles": {
"administrator": "Administrator",
"editor": "Editor",
"customer": "Customer",
"shop_manager": "Shop manager",
"wholesale_customer": "Wholesale customer",
"b2b_customer": "B2B customer",
"...": "..."
},
"fixed_roles": ["wholesale_customer"]
}
}
| Field | Type | Meaning |
|---|---|---|
rules |
object[] |
Each rule: role (role slug), currency (a code, or * for all currencies) and percent (negative for a discount) |
roles |
object |
Every WordPress role, slug to name |
fixed_roles |
string[] |
Roles that get their own price fields on each product |
Errors
| Status | Code | When |
|---|---|---|
401 / 403 |
rest_forbidden |
The caller lacks the capability: Sorry, you are not allowed to do that. |
Plus the errors every endpoint can return.
Examples
curl -s "https://your-store.example/wp-json/plugixa-multi-currency/v1/pro/role-prices" \
-u "$WP_USER:$WP_APP_PASSWORD"
<?php
$ch = curl_init('https://your-store.example/wp-json/plugixa-multi-currency/v1/pro/role-prices');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_USERPWD => getenv('WP_USER') . ':' . getenv('WP_APP_PASSWORD'),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('https://your-store.example/wp-json/plugixa-multi-currency/v1/pro/role-prices', {
headers: {
'Authorization': `Basic ${btoa(`${process.env.WP_USER}:${process.env.WP_APP_PASSWORD}`)}`,
},
});
const { data } = await response.json();
Quick Links
Share