Contents
On this page
Update Supplier - Plugixa POS for WooCommerce
PUT /plugixa-pos/v1/suppliers/{id}
Replace a supplier’s details. Fields you leave out take their default (empty, 0, active), so send the whole supplier. 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
Path parameters
| Name | Type | Description |
|---|---|---|
id |
integer |
The supplier’s id |
Request body
Content type: application/json
| Field | Type | Required | Description |
|---|---|---|---|
name |
string |
Yes | 1 to 190 characters. |
contact |
string |
No | Contact person. |
email |
string |
No | Email. |
phone |
string |
No | Phone. |
tax_id |
string |
No | Tax id. |
notes |
string |
No | Up to 2000 characters. |
lead_time_days |
integer |
No | 0 to 365. |
address |
object |
No | address_1, address_2, postcode, city, country. |
status |
string |
No | active (default) or archived. |
{
"id": 2,
"name": "Atelier Grès & Terre",
"contact": "",
"email": "contact@gres-terre.test",
"phone": "04 78 00 00 00",
"address": {
"address_1": "",
"address_2": "",
"postcode": "",
"city": "",
"country": ""
},
"tax_id": "",
"lead_time_days": 10,
"notes": "",
"status": "active"
}
Responses
200 OK.
{
"success": true,
"data": {
"id": 2,
"name": "Atelier Grès & Terre",
"contact": "",
"email": "contact@gres-terre.test",
"phone": "04 78 00 00 00",
"address": {
"address_1": "",
"address_2": "",
"postcode": "",
"city": "",
"country": ""
},
"tax_id": "",
"lead_time_days": 10,
"notes": "",
"status": "active"
}
}
Errors
| Status | Code | When |
|---|---|---|
404 |
plugixa_pos_not_found |
No supplier with that id. |
Plus the errors every endpoint can return.
Examples
curl -s -X PUT "https://your-site.example/wp-json/plugixa-pos/v1/suppliers/2" \
-u "$WP_USER:$WP_APP_PASSWORD" \
-H "Content-Type: application/json" \
-d '{"id":2,"name":"Atelier Grès & Terre","contact":"","email":"contact@gres-terre.test","phone":"04 78 00 00 00","address":{"address_1":"","address_2":"","postcode":"","city":"","country":""},"tax_id":"","lead_time_days":10,"notes":"","status":"active"}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-pos/v1/suppliers/2');
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([
'id' => 2,
'name' => 'Atelier Grès & Terre',
'contact' => '',
'email' => 'contact@gres-terre.test',
'phone' => '04 78 00 00 00',
'address' => [
'address_1' => '',
'address_2' => '',
'postcode' => '',
'city' => '',
'country' => '',
],
'tax_id' => '',
'lead_time_days' => 10,
'notes' => '',
'status' => 'active',
]),
]);
$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', {
method: 'PUT',
headers: {
'Authorization': `Basic ${btoa(`${process.env.WP_USER}:${process.env.WP_APP_PASSWORD}`)}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({ id: 2, name: 'Atelier Grès & Terre', contact: '', email: 'contact@gres-terre.test', phone: '04 78 00 00 00', address: { address_1: '', address_2: '', postcode: '', city: '', country: '' }, tax_id: '', lead_time_days: 10, notes: '', status: 'active' }),
});
const { data } = await response.json();
Quick Links
Share