Contents
On this page
Save Favourites - Plugixa POS for WooCommerce
PUT /plugixa-pos/v1/registers/{id}/favourites
Replace the register’s favourite products, the quick buttons of the register screen. POST and PATCH work the same way.
Needs a user with the plugixa_pos_sell 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. The user must also be allowed to use the register (register access).
Request
PUT https://your-site.example/wp-json/plugixa-pos/v1/registers/1/favourites
Path parameters
| Name | Type | Description |
|---|---|---|
id |
integer |
The register’s id |
Request body
Content type: application/json
| Field | Type | Required | Description |
|---|---|---|---|
product_ids |
integer[] |
Yes | Up to 48 product ids, in display order. Variations, unknown ids and repeats are dropped. |
{
"product_ids": [3728, 3720, 3800]
}
Responses
200 OK. data.favourites is the list as saved.
{
"success": true,
"data": {
"favourites": [3728, 3720, 3800]
}
}
Errors
| Status | Code | When |
|---|---|---|
403 |
plugixa_pos_register_forbidden |
The register is missing or archived, or the user may not use it. |
400 |
rest_invalid_param |
More than 48 ids, or an id below 1. |
Plus the errors every endpoint can return.
Examples
curl -s -X PUT "https://your-site.example/wp-json/plugixa-pos/v1/registers/1/favourites" \
-u "$WP_USER:$WP_APP_PASSWORD" \
-H "Content-Type: application/json" \
-d '{"product_ids":[3728,3720,3800]}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-pos/v1/registers/1/favourites');
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([
'product_ids' => [3728, 3720, 3800],
]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('https://your-site.example/wp-json/plugixa-pos/v1/registers/1/favourites', {
method: 'PUT',
headers: {
'Authorization': `Basic ${btoa(`${process.env.WP_USER}:${process.env.WP_APP_PASSWORD}`)}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({ product_ids: [3728, 3720, 3800] }),
});
const { data } = await response.json();
Quick Links
Share