Contents
On this page
Set Supplier Product - Plugixa POS for WooCommerce
PUT /plugixa-pos/v1/suppliers/{id}/products/{product_id}
Add a product to a supplier or change its terms. Only the fields you send change. POST and PATCH work the same way.
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
PUT https://your-site.example/wp-json/plugixa-pos/v1/suppliers/2/products/3745
Path parameters
| Name | Type | Description |
|---|---|---|
id |
integer |
The supplier’s id |
product_id |
integer |
A simple product or a variation |
Request body
Content type: application/json
| Field | Type | Required | Description |
|---|---|---|---|
supplier_sku |
string |
No | The supplier’s reference. |
cost |
string|null |
No | Unit cost, decimal. |
pack_size |
integer |
No | 1 or more. |
reorder_point |
integer|null |
No | Reorder at or below this stock. |
reorder_qty |
integer|null |
No | How many to reorder. |
{
"cost": "4.90",
"reorder_point": 4,
"reorder_qty": 12
}
Responses
200 OK. data is the link.
{
"success": true,
"data": {
"product_id": 3745,
"name": "Ceramic bowl",
"sku": "KIT-BOWL",
"supplier_sku": "",
"cost": "4.9000",
"pack_size": 1,
"reorder_point": 4,
"reorder_qty": 12
}
}
Errors
| Status | Code | When |
|---|---|---|
404 |
plugixa_pos_not_found |
No supplier, or no such product (variable parents are refused). |
Plus the errors every endpoint can return.
Examples
curl -s -X PUT "https://your-site.example/wp-json/plugixa-pos/v1/suppliers/2/products/3745" \
-u "$WP_USER:$WP_APP_PASSWORD" \
-H "Content-Type: application/json" \
-d '{"cost":"4.90","reorder_point":4,"reorder_qty":12}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-pos/v1/suppliers/2/products/3745');
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([
'cost' => '4.90',
'reorder_point' => 4,
'reorder_qty' => 12,
]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('https://your-site.example/wp-json/plugixa-pos/v1/suppliers/2/products/3745', {
method: 'PUT',
headers: {
'Authorization': `Basic ${btoa(`${process.env.WP_USER}:${process.env.WP_APP_PASSWORD}`)}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({ cost: '4.90', reorder_point: 4, reorder_qty: 12 }),
});
const { data } = await response.json();
Quick Links
Share