Contents
On this page

Update Store Stock - Plugixa POS for WooCommerce

PUT /plugixa-pos/v1/outlet-stock/{id}

Set the counted quantity of one store, or its own regular and sale price. POST and PATCH work the same way.

Needs a user with the plugixa_pos_manage_settings capability (signed in with an Application Password, or the login cookie with an X-WP-Nonce header). Administrators hold it; other roles only when you grant it.

Request

PUT https://your-site.example/wp-json/plugixa-pos/v1/outlet-stock/3801

Path parameters

Name Type Description
id integer A simple product or a variation

Request body

Content type: application/json

Field Type Required Description
outlet_id integer Yes The store.
quantity integer No The counted quantity, 0 or more. Needs WooCommerce stock management on the product.
regular_price string|null No Store regular price. Empty or null removes it.
sale_price string|null No Store sale price. Empty or null removes it.
reason string No Passed to the plugixa_pos_store_stock_counted action with a quantity.
note string No Passed to the same action.
{
  "outlet_id": 2,
  "quantity": 14,
  "regular_price": "27.00"
}

Responses

200 OK. data is the row, as in List Store Stock.

{
  "success": true,
  "data": {
    "id": 3801,
    "name": "Canvas tote - Natural",
    "sku": "ACC-TOTE-NAT",
    "price": "25",
    "manage_stock": true,
    "total": 35,
    "stock": {
      "1": 21,
      "2": 14
    },
    "prices": {
      "2": {
        "regular": "27.00",
        "sale": null
      }
    }
  }
}

Errors

Status Code When
404 plugixa_pos_not_found No such product (variable parents are refused), or no such store.
409 plugixa_pos_not_stocked A quantity for a product without stock management.

Plus the errors every endpoint can return.

Examples

curl -s -X PUT "https://your-site.example/wp-json/plugixa-pos/v1/outlet-stock/3801" \
  -u "$WP_USER:$WP_APP_PASSWORD" \
  -H "Content-Type: application/json" \
  -d '{"outlet_id":2,"quantity":14,"regular_price":"27.00"}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-pos/v1/outlet-stock/3801');
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([
        'outlet_id'     => 2,
        'quantity'      => 14,
        'regular_price' => '27.00',
    ]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('https://your-site.example/wp-json/plugixa-pos/v1/outlet-stock/3801', {
  method: 'PUT',
  headers: {
    'Authorization': `Basic ${btoa(`${process.env.WP_USER}:${process.env.WP_APP_PASSWORD}`)}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ outlet_id: 2, quantity: 14, regular_price: '27.00' }),
});
const { data } = await response.json();

Quick Links

Share