Contents
On this page

Run Cache Diagnostics - Plugixa Multi Currency for WooCommerce

GET /plugixa-multi-currency/v1/diagnostics

The Check my site button of Tools > Caching: it loads a product page in two currencies through your site, looks for a page cache and its settings, and tests the price endpoint, the cart and the rates. See Page caching.

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. The checks make real requests to your own site, so the call takes a few seconds. Pro only: on the free plugin this route answers 404 rest_no_route.

Request

GET https://your-store.example/wp-json/plugixa-multi-currency/v1/diagnostics

Responses

200 OK.

{
  "success": true,
  "data": {
    "checks": [
      {
        "id": "cache",
        "status": "info",
        "title": "No page cache found",
        "detail": "No cache plugin is active and the test page came back without cache headers. If your host or a CDN caches pages, use cache-first mode anyway."
      },
      {
        "id": "mode",
        "status": "ok",
        "title": "Cache mode",
        "detail": "Server mode is on, which is right for a site without a page cache."
      },
      {
        "id": "live",
        "status": "ok",
        "title": "Live product page",
        "detail": "Shoppers get the page in their own currency (USD and EUR tested)."
      },
      {
        "id": "prices",
        "status": "ok",
        "title": "Price endpoint",
        "detail": "The browser can fetch prices in other currencies."
      },
      {
        "id": "store_api",
        "status": "ok",
        "title": "Cart and checkout blocks",
        "detail": "The cart is calculated in the shopper's currency (EUR tested)."
      },
      {
        "id": "rates",
        "status": "ok",
        "title": "Exchange rates",
        "detail": "Rates were updated 26 seconds ago."
      }
    ],
    "cache_mode": "server",
    "plugins": [],
    "cache_found": false,
    "can_vary": ["wp-rocket", "litespeed", "wp-super-cache"],
    "tested": {
      "product": "T-Shirt with Logo",
      "currency": "EUR"
    }
  }
}
Field Type Meaning
checks object[] Each check: id, status (ok, info, warn or fail), title, detail
cache_mode string server or cache_first
plugins object Cache plugins found, id to name: wp-rocket, litespeed, w3tc, wp-super-cache, wp-fastest-cache, breeze, wp-optimize, cloudflare. An empty list when none
cache_found boolean Whether a cache plugin or cache headers were found
can_vary string[] Cache plugins that can keep one copy of a page per currency
tested object The product and the other currency used for the test

Errors

Status Code When
401 / 403 plugixa_multi_currency_forbidden The caller lacks the capability.

Plus the errors every endpoint can return.

Examples

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

Quick Links

Share