Contents
On this page

Resync WooCommerce Analytics - Plugixa Multi Currency for WooCommerce

POST /plugixa-multi-currency/v1/pro/analytics/resync

WooCommerce Analytics adds up orders as numbers, whatever their currency. With Pro, new orders reach Analytics in your store currency; this queues the orders placed before, so their figures are converted too. See WooCommerce Analytics.

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

POST https://your-store.example/wp-json/plugixa-multi-currency/v1/pro/analytics/resync

Request body

Content type: application/json

No body.

Responses

200 OK.

{
  "success": true,
  "data": {
    "queued": 48
  }
}
Field Type Meaning
queued integer Orders and refunds in a currency other than the store currency, queued in batches

The batches run in the background on Action Scheduler: see WooCommerce > Status > Scheduled Actions. Analytics shows the new figures once they are done.

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 POST "https://your-store.example/wp-json/plugixa-multi-currency/v1/pro/analytics/resync" \
  -u "$WP_USER:$WP_APP_PASSWORD"
<?php
$ch = curl_init('https://your-store.example/wp-json/plugixa-multi-currency/v1/pro/analytics/resync');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST  => 'POST',
    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/analytics/resync', {
  method: 'POST',
  headers: {
    'Authorization': `Basic ${btoa(`${process.env.WP_USER}:${process.env.WP_APP_PASSWORD}`)}`,
  },
});
const { data } = await response.json();

Quick Links

Share