Contents
Get Detection Settings - Plugixa Multi Currency for WooCommerce
GET /plugixa-multi-currency/v1/pro/detection
The detection sources of Settings > Country detection, plus the languages of your translation plugin. Geolocation itself is the geo_detect setting. See Country detection and Multilingual sites.
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/detection
Responses
200 OK.
{
"success": true,
"data": {
"language": true,
"billing_country": true,
"cloudflare": false,
"checkout_country": true,
"country_field": "billing",
"language_map": {
"fr": "EUR",
"de": "EUR",
"ja": "JPY"
},
"plugin": "Polylang",
"languages": {
"en": "English",
"fr": "Français",
"de": "Deutsch",
"ja": "日本語"
},
"cloudflare_seen": false
}
}
| Field | Type | Meaning |
|---|---|---|
language |
boolean |
Pick the currency from the page language |
billing_country |
boolean |
Pick it from a signed-in customer’s saved address |
cloudflare |
boolean |
Pick it from Cloudflare’s visitor country header |
checkout_country |
boolean |
Switch to the currency of the country entered at checkout |
country_field |
string |
billing or shipping: which address counts |
language_map |
object |
Language code to currency code |
plugin |
string |
The translation plugin found: WPML, Polylang, TranslatePress or empty |
languages |
object |
Its languages, code to name |
cloudflare_seen |
boolean |
Whether this request came with Cloudflare’s country header |
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/detection" \
-u "$WP_USER:$WP_APP_PASSWORD"
<?php
$ch = curl_init('https://your-store.example/wp-json/plugixa-multi-currency/v1/pro/detection');
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/detection', {
headers: {
'Authorization': `Basic ${btoa(`${process.env.WP_USER}:${process.env.WP_APP_PASSWORD}`)}`,
},
});
const { data } = await response.json();
Quick Links
Share