Contents
On this page

Receive Lot - Plugixa POS for WooCommerce

POST /plugixa-pos/v1/lots

Record units received under a lot number. By default the units are also added to stock.

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

POST https://your-site.example/wp-json/plugixa-pos/v1/lots

Request body

Content type: application/json

Field Type Required Description
product_id integer Yes A product that tracks lots, with stock management.
outlet_id integer No The store. Defaults to the default store.
lot string Yes Lot number, up to 60 characters.
expiry string|null No YYYY-MM-DD.
quantity integer Yes 1 to 1000000.
add_stock boolean No Add the units to stock. Defaults to true; false when the stock is already counted.
{
  "product_id": 3734,
  "outlet_id": 1,
  "lot": "L2611-A",
  "expiry": "2027-05-31",
  "quantity": 24
}

Responses

201 Created. data is the lot.

{
  "success": true,
  "data": {
    "id": 3,
    "lot": "L2611-A",
    "expiry": "2027-05-31",
    "days_left": 193,
    "expired": false,
    "quantity": 24,
    "outlet_id": 1,
    "product": {
      "id": 3734,
      "name": "Ceremonial matcha 30 g",
      "sku": "TEA-MATCHA"
    },
    "updated_at": "2026-11-19 16:30:00"
  }
}

Errors

Status Code When
404 plugixa_pos_not_found No such product or store.
422 plugixa_pos_lot_untracked The product does not track lots, or its stock is not managed.
422 plugixa_pos_invalid No lot number, no quantity, or a bad expiry date.
500 plugixa_pos_failed The lot could not be saved.

Plus the errors every endpoint can return.

Examples

curl -s -X POST "https://your-site.example/wp-json/plugixa-pos/v1/lots" \
  -u "$WP_USER:$WP_APP_PASSWORD" \
  -H "Content-Type: application/json" \
  -d '{"product_id":3734,"outlet_id":1,"lot":"L2611-A","expiry":"2027-05-31","quantity":24}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-pos/v1/lots');
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([
        'product_id' => 3734,
        'outlet_id'  => 1,
        'lot'        => 'L2611-A',
        'expiry'     => '2027-05-31',
        'quantity'   => 24,
    ]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('https://your-site.example/wp-json/plugixa-pos/v1/lots', {
  method: 'POST',
  headers: {
    'Authorization': `Basic ${btoa(`${process.env.WP_USER}:${process.env.WP_APP_PASSWORD}`)}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ product_id: 3734, outlet_id: 1, lot: 'L2611-A', expiry: '2027-05-31', quantity: 24 }),
});
const { data } = await response.json();

Quick Links

Share