Contents
On this page

Create Purchase Order - Plugixa POS for WooCommerce

POST /plugixa-pos/v1/purchase-orders

Create a draft order. Mark it ordered with Place Purchase Order.

Needs a user with the plugixa_pos_purchase capability (signed in with an Application Password, or the login cookie with an X-WP-Nonce header). Unlike the other capabilities, Pro gives this one to administrators and to the WooCommerce Shop manager role.

Request

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

Request body

Content type: application/json

Field Type Required Description
supplier_id integer Yes An active supplier.
outlet_id integer No The store receiving the goods. Defaults to 0, the home store.
expected_at string|null No Expected date, YYYY-MM-DD.
note string No Up to 1000 characters.
lines object[] Yes 1 to 500: product_id (a simple product or variation), qty and unit_cost (decimal, optional: the supplier cost otherwise).
{
  "supplier_id": 2,
  "outlet_id": 1,
  "expected_at": "2026-11-21",
  "lines": [
    {
      "product_id": 3745,
      "qty": 12,
      "unit_cost": "4.90"
    }
  ]
}

Responses

201 Created.

{
  "success": true,
  "data": {
    "id": 3,
    "number": "PO-000003",
    "supplier_id": 2,
    "supplier_name": "Atelier Grès & Terre",
    "outlet_id": 1,
    "outlet_name": "Maison Plugixa Marais",
    "status": "draft",
    "expected_at": "2026-11-21",
    "note": "",
    "created_at": "2026-11-05 09:00:00",
    "ordered_at": null,
    "closed_at": null,
    "total": "58.80",
    "items": [
      {
        "id": 11,
        "product_id": 3745,
        "name": "Ceramic bowl",
        "sku": "KIT-BOWL",
        "qty_ordered": 12,
        "qty_received": 0,
        "unit_cost": "4.9000",
        "total": "58.80"
      }
    ],
    "receipts": []
  }
}

Errors

Status Code When
422 plugixa_pos_not_found No active supplier, or the store does not exist.
422 plugixa_pos_empty_order No lines.
422 plugixa_pos_invalid_line A line has no valid product or quantity.

Plus the errors every endpoint can return.

Examples

curl -s -X POST "https://your-site.example/wp-json/plugixa-pos/v1/purchase-orders" \
  -u "$WP_USER:$WP_APP_PASSWORD" \
  -H "Content-Type: application/json" \
  -d '{"supplier_id":2,"outlet_id":1,"expected_at":"2026-11-21","lines":[{"product_id":3745,"qty":12,"unit_cost":"4.90"}]}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-pos/v1/purchase-orders');
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([
        'supplier_id' => 2,
        'outlet_id'   => 1,
        'expected_at' => '2026-11-21',
        'lines'       => [
            [
                'product_id' => 3745,
                'qty'        => 12,
                'unit_cost'  => '4.90',
            ],
        ],
    ]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('https://your-site.example/wp-json/plugixa-pos/v1/purchase-orders', {
  method: 'POST',
  headers: {
    'Authorization': `Basic ${btoa(`${process.env.WP_USER}:${process.env.WP_APP_PASSWORD}`)}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ supplier_id: 2, outlet_id: 1, expected_at: '2026-11-21', lines: [{ product_id: 3745, qty: 12, unit_cost: '4.90' }] }),
});
const { data } = await response.json();

Quick Links

Share