Contents
On this page
Save Invoice Layout - Plugixa POS for WooCommerce
PUT /plugixa-pos/v1/invoice-layout
Save the design. The answer is the same as Get Invoice Layout.
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.
Request
PUT https://your-site.example/wp-json/plugixa-pos/v1/invoice-layout
Request body
Content type: application/json
| Field | Type | Required | Description |
|---|---|---|---|
layout |
object |
Yes | version and schemas: up to 150 elements of type text, image, rectangle, ellipse or line, positioned in mm. One element must be named lines (at least 90 by 40 mm): the lines, VAT and totals go there. |
active |
boolean |
No | Use it for invoices. Defaults to true. |
{
"active": true,
"layout": {
"version": 1,
"schemas": [
{
"name": "seller_company",
"type": "text",
"content": "{seller_company}",
"position": {
"x": 13,
"y": 14
},
"width": 110,
"height": 8,
"rotate": 0,
"opacity": 1,
"readOnly": true,
"fontName": "dejavusans-bold",
"fontSize": 14,
"fontColor": "#1f2937",
"alignment": "left",
"verticalAlignment": "top",
"lineHeight": 1.3,
"characterSpacing": 0,
"backgroundColor": ""
},
{
"name": "lines",
"type": "rectangle",
"position": {
"x": 13,
"y": 100
},
"width": 184,
"height": 120
}
]
}
}
Responses
200 OK. data is as in Get Invoice Layout.
Errors
| Status | Code | When |
|---|---|---|
422 |
plugixa_pos_layout_lines |
The lines element is missing or smaller than 90 by 40 mm. |
Plus the errors every endpoint can return.
Examples
curl -s -X PUT "https://your-site.example/wp-json/plugixa-pos/v1/invoice-layout" \
-u "$WP_USER:$WP_APP_PASSWORD" \
-H "Content-Type: application/json" \
-d '{"active":true,"layout":{"version":1,"schemas":[{"name":"seller_company","type":"text","content":"{seller_company}","position":{"x":13,"y":14},"width":110,"height":8,"rotate":0,"opacity":1,"readOnly":true,"fontName":"dejavusans-bold","fontSize":14,"fontColor":"#1f2937","alignment":"left","verticalAlignment":"top","lineHeight":1.3,"characterSpacing":0,"backgroundColor":""},{"name":"lines","type":"rectangle","position":{"x":13,"y":100},"width":184,"height":120}]}}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-pos/v1/invoice-layout');
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([
'active' => true,
'layout' => [
'version' => 1,
'schemas' => [
[
'name' => 'seller_company',
'type' => 'text',
'content' => '{seller_company}',
'position' => [
'x' => 13,
'y' => 14,
],
'width' => 110,
'height' => 8,
'rotate' => 0,
'opacity' => 1,
'readOnly' => true,
'fontName' => 'dejavusans-bold',
'fontSize' => 14,
'fontColor' => '#1f2937',
'alignment' => 'left',
'verticalAlignment' => 'top',
'lineHeight' => 1.3,
'characterSpacing' => 0,
'backgroundColor' => '',
],
[
'name' => 'lines',
'type' => 'rectangle',
'position' => [
'x' => 13,
'y' => 100,
],
'width' => 184,
'height' => 120,
],
],
],
]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('https://your-site.example/wp-json/plugixa-pos/v1/invoice-layout', {
method: 'PUT',
headers: {
'Authorization': `Basic ${btoa(`${process.env.WP_USER}:${process.env.WP_APP_PASSWORD}`)}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({ active: true, layout: { version: 1, schemas: [{ name: 'seller_company', type: 'text', content: '{seller_company}', position: { x: 13, y: 14 }, width: 110, height: 8, rotate: 0, opacity: 1, readOnly: true, fontName: 'dejavusans-bold', fontSize: 14, fontColor: '#1f2937', alignment: 'left', verticalAlignment: 'top', lineHeight: 1.3, characterSpacing: 0, backgroundColor: '' }, { name: 'lines', type: 'rectangle', position: { x: 13, y: 100 }, width: 184, height: 120 }] } }),
});
const { data } = await response.json();
Quick Links
Share