Contents
On this page

Update Settings - Plugixa Multi Currency for WooCommerce

POST /plugixa-multi-currency/v1/settings

Save settings. Send only the keys you want to change; the others keep their value. POST and PUT 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.

Request

POST https://your-store.example/wp-json/plugixa-multi-currency/v1/settings

Request body

Content type: application/json

Field Type Required Description
auto_rates boolean No Update rates automatically. Daily by default; Pro offers other intervals
floating_switcher boolean No Show the floating currency button
floating_position string No right or left: the bottom corner of the button
delete_data_on_uninstall boolean No Erase the plugin’s data when it is deleted. See Privacy and uninstall
cache_mode string No Pro: server or cache_first. See Page caching
geo_detect boolean No Pro: pick the currency from the shopper’s country
country_map object No Pro: country overrides, country code to currency code, for example {"CH": "EUR"}
switcher_product_page boolean No Pro: show a switcher under the product price
switcher_mini_cart boolean No Pro: show a switcher in the mini-cart
switcher_auto_style string No Pro: the style of those two switchers, inline or pill

Unknown keys are dropped, and a value of the wrong kind falls back to the default. Turning auto_rates on schedules the daily update and runs one straight away; turning it off removes the schedule.

{
  "auto_rates": true,
  "floating_switcher": true,
  "floating_position": "left"
}

Responses

200 OK. data.settings is every setting as saved.

{
  "success": true,
  "data": {
    "settings": {
      "auto_rates": true,
      "floating_switcher": true,
      "floating_position": "left",
      "setup_done": true,
      "delete_data_on_uninstall": false,
      "...": "..."
    }
  }
}

Fields as in Get Settings.

Errors

Status Code When
401 / 403 plugixa_multi_currency_forbidden The caller lacks the capability.
401 / 403 plugixa_multi_currency_forbidden delete_data_on_uninstall changes and the user is not a site administrator: Only a site administrator can change what deleting the plugin does to the currency data.

Plus the errors every endpoint can return.

Sending delete_data_on_uninstall with its current value is not a change and needs no extra right.

Examples

curl -s -X POST "https://your-store.example/wp-json/plugixa-multi-currency/v1/settings" \
  -u "$WP_USER:$WP_APP_PASSWORD" \
  -H "Content-Type: application/json" \
  -d '{"auto_rates":true,"floating_switcher":true,"floating_position":"left"}'
<?php
$ch = curl_init('https://your-store.example/wp-json/plugixa-multi-currency/v1/settings');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST  => 'POST',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_USERPWD        => getenv('WP_USER') . ':' . getenv('WP_APP_PASSWORD'),
    CURLOPT_HTTPHEADER     => ['Content-Type: application/json'],
    CURLOPT_POSTFIELDS     => json_encode([
        'auto_rates'        => true,
        'floating_switcher' => true,
        'floating_position' => 'left',
    ]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('https://your-store.example/wp-json/plugixa-multi-currency/v1/settings', {
  method: 'POST',
  headers: {
    'Authorization': `Basic ${btoa(`${process.env.WP_USER}:${process.env.WP_APP_PASSWORD}`)}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ auto_rates: true, floating_switcher: true, floating_position: 'left' }),
});
const { data } = await response.json();

Quick Links

Share