Contents
On this page

Get Option Stock - Plugixa Extra Product Options

GET /plugixa-epo/v1/stock/{id}

The stock of every tracked choice of a group. Choices that are not tracked (unlimited) are left out. See Stock per option.

Needs a user with the plugixa_epo_manage capability (signed in with an Application Password, or the login cookie with an X-WP-Nonce header). Administrators and shop managers hold it; see Permissions. Pro only: on the free plugin this route answers 404 rest_no_route.

Request

GET https://your-store.example/wp-json/plugixa-epo/v1/stock/7

Path parameters

Name Type Description
id integer The group’s id

Responses

200 OK. data is field id => choice id => how many are left.

{
  "success": true,
  "data": {
    "fk3q8x2ma": {
      "op7r2v9tc": 5
    }
  }
}

{} when no choice of the group is tracked.

Errors

Status Code When
401 / 403 plugixa_epo_forbidden The caller lacks the capability: You are not allowed to do that.
404 plugixa_epo_not_found No group has this id: Not found.

Plus the errors every endpoint can return.

Examples

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

Quick Links

Share