Contents
On this page

Update Bundle - Plugixa POS for WooCommerce

PUT /plugixa-pos/v1/bundles/{id}

Change a bundle. components must be sent every time; name, price and SKU only when they change. POST and PATCH work the same way.

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/bundles/4470

Path parameters

Name Type Description
id integer The bundle’s product id

Request body

Content type: application/json

Field Type Required Description
name string No Up to 200 characters. Needed when the product has none.
price string No Regular price, decimal. Needed when the product has none.
sku string No SKU, unique in WooCommerce.
components object[] Yes 1 to 50 rows of id (a simple product or a variation, not a bundle) and qty (1 to 999). The same product twice is merged.
{
  "price": "37.00",
  "components": [
    {
      "id": 3720,
      "qty": 2
    },
    {
      "id": 3728,
      "qty": 1
    }
  ]
}

Responses

200 OK.

{
  "success": true,
  "data": {
    "id": 4470,
    "name": "Coffee lover set",
    "sku": "SET-COFFEE",
    "price": "37.00",
    "status": "publish",
    "edit_url": "https://your-site.example/wp-admin/post.php?post=4470&action=edit",
    "own_stock": false,
    "components": [
      {
        "id": 3720,
        "qty": 1,
        "name": "House espresso beans 250 g",
        "sku": "COF-HOUSE",
        "stock": 38,
        "cost": "3.8000",
        "price": "9.90"
      },
      {
        "id": 3728,
        "qty": 1,
        "name": "French press 1 L",
        "sku": "COF-PRESS",
        "stock": 3,
        "cost": "13.0000",
        "price": "27.00"
      }
    ],
    "available": 3,
    "parts_value": "36.90",
    "cost": "16.8000",
    "margin": "48.3"
  }
}

Errors

Status Code When
404 plugixa_pos_not_found No product with that id.
422 plugixa_pos_bundle_part No components sent, or a component is not valid.

Plus the errors every endpoint can return.

Examples

curl -s -X PUT "https://your-site.example/wp-json/plugixa-pos/v1/bundles/4470" \
  -u "$WP_USER:$WP_APP_PASSWORD" \
  -H "Content-Type: application/json" \
  -d '{"price":"37.00","components":[{"id":3720,"qty":2},{"id":3728,"qty":1}]}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-pos/v1/bundles/4470');
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([
        'price'      => '37.00',
        'components' => [
            [
                'id'  => 3720,
                'qty' => 2,
            ],
            [
                'id'  => 3728,
                'qty' => 1,
            ],
        ],
    ]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('https://your-site.example/wp-json/plugixa-pos/v1/bundles/4470', {
  method: 'PUT',
  headers: {
    'Authorization': `Basic ${btoa(`${process.env.WP_USER}:${process.env.WP_APP_PASSWORD}`)}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ price: '37.00', components: [{ id: 3720, qty: 2 }, { id: 3728, qty: 1 }] }),
});
const { data } = await response.json();

Quick Links

Share