Contents
On this page

Update Currency URLs - Plugixa Multi Currency for WooCommerce

PUT /plugixa-multi-currency/v1/pro/seo

Save the currency URL settings. PUT and POST work the same way.

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 404 rest_no_route.

Request

PUT https://your-store.example/wp-json/plugixa-multi-currency/v1/pro/seo

Request body

Content type: application/json

Field Type Required Description
enabled boolean No Currency URLs on or off.
hreflang object No Currency code to tag, such as fr or fr-FR. Replaces the whole map; entries with an unknown currency or an invalid tag are dropped.
{
  "enabled": true,
  "hreflang": {
    "EUR": "fr-FR",
    "GBP": "en-GB"
  }
}

Responses

200 OK. data is the settings as saved, as in Get Currency URLs.

{
  "success": true,
  "data": {
    "enabled": true,
    "hreflang": {
      "EUR": "fr-FR",
      "GBP": "en-GB"
    },
    "example": {
      "USD": "https://your-store.example/shop/",
      "EUR": "https://your-store.example/eur/shop/",
      "GBP": "https://your-store.example/gbp/shop/",
      "...": "..."
    }
  }
}

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 -X PUT "https://your-store.example/wp-json/plugixa-multi-currency/v1/pro/seo" \
  -u "$WP_USER:$WP_APP_PASSWORD" \
  -H "Content-Type: application/json" \
  -d '{"enabled":true,"hreflang":{"EUR":"fr-FR","GBP":"en-GB"}}'
<?php
$ch = curl_init('https://your-store.example/wp-json/plugixa-multi-currency/v1/pro/seo');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST  => 'PUT',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_USERPWD        => getenv('WP_USER') . ':' . getenv('WP_APP_PASSWORD'),
    CURLOPT_HTTPHEADER     => ['Content-Type: application/json'],
    CURLOPT_POSTFIELDS     => json_encode([
        'enabled'  => true,
        'hreflang' => [
            'EUR' => 'fr-FR',
            'GBP' => 'en-GB',
        ],
    ]),
]);
$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/seo', {
  method: 'PUT',
  headers: {
    'Authorization': `Basic ${btoa(`${process.env.WP_USER}:${process.env.WP_APP_PASSWORD}`)}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ enabled: true, hreflang: { EUR: 'fr-FR', GBP: 'en-GB' } }),
});
const { data } = await response.json();

Quick Links

Share