Contents
List Promotions - Plugixa POS for WooCommerce
GET /plugixa-pos/v1/promotions
Every promotion, active or not.
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.
Note. On the way in, a
fixedvalueandmin_totalare decimal amounts ("5.00"). On the way out they are integers in minor units (500). Convert before sending a promotion you read back, or it is saved 100 times larger.
Request
GET https://your-site.example/wp-json/plugixa-pos/v1/promotions
Responses
200 OK.
{
"success": true,
"data": [
{
"id": 1,
"name": "Coffee happy hour -20%",
"type": "item_discount",
"active": true,
"priority": 0,
"all": false,
"products": [],
"categories": [119],
"value_type": "percent",
"value": 20,
"min_qty": 3,
"buy": 2,
"get": 1,
"min_total": 0,
"roles": [],
"starts_at": null,
"ends_at": null,
"days": [],
"time_from": "14:00",
"time_to": "16:00",
"product_names": {}
},
{
"id": 3,
"name": "Spend 50, get 5 off",
"type": "cart_threshold",
"active": true,
"priority": 0,
"all": false,
"products": [],
"categories": [],
"value_type": "fixed",
"value": 500,
"min_qty": 0,
"buy": 0,
"get": 0,
"min_total": 5000,
"roles": [],
"starts_at": null,
"ends_at": null,
"days": [],
"time_from": null,
"time_to": null,
"product_names": {}
}
]
}
| Field | Type | Meaning |
|---|---|---|
data[].product_names |
object |
Names of the products in products, by id |
Errors
This endpoint has no errors of its own.
Plus the errors every endpoint can return.
Examples
curl -s "https://your-site.example/wp-json/plugixa-pos/v1/promotions" \
-u "$WP_USER:$WP_APP_PASSWORD"
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-pos/v1/promotions');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_USERPWD => getenv('WP_USER') . ':' . getenv('WP_APP_PASSWORD'),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('https://your-site.example/wp-json/plugixa-pos/v1/promotions', {
headers: {
'Authorization': `Basic ${btoa(`${process.env.WP_USER}:${process.env.WP_APP_PASSWORD}`)}`,
},
});
const { data } = await response.json();
Quick Links
Share