This document is written for WooCommerce developers looking to extend or customize WooCommerce Product Bundles. It requires an advanced understanding of PHP and WordPress development.
WooCommerce 2.6 added support for REST API endpoints based on the WordPress REST API infrastructure.
Product Bundles extends the /products/ and /orders/ endpoint responses with 2 new properties: bundled_by and bundled_items.
- In product context, bundled_bylists all product bundle IDs that a product has been added to, whilebundled_itemslists the bundled item data associated with a product of the bundle type.
- In order context, bundled_byis applicable to bundled order items and references the order item ID of their parent, whilebundled_itemsis applicable to bundle parent items and lists the associated bundled line item IDs.
Additionally, Product Bundles 8.3.0 added support for Store API cart/add-item, cart/update-item and cart/remove-item endpoints to allow updating cart via Store API programmatically. 
Products
↑ Back to topProduct Properties
↑ Back to top| Attribute | Type | Context | Description | 
|---|---|---|---|
| bundled_by | array | read | List of product bundle IDs that contain this product. | 
| bundle_virtual | boolean | readwrite | Forces all contents of this bundle to be treated as virtual. | 
| bundle_layout | string | readwrite | Single-product details page layout. Applicable for bundle-type products only. Values: default,tabular. | 
| bundle_add_to_cart_form_location | string | readwrite | Controls the form location of the product in the single-product page. Applicable to bundle-type products. Values: default,after_summary. | 
| bundle_editable_in_cart | boolean | readwrite | Controls whether the configuration of this product can be modified from the cart page. Applicable to bundle-type products. | 
| bundle_item_grouping | string | readwrite | Controls the display of bundle container/child items in cart/order templates. Applicable for bundle-type products only. Values: parent,noindent,none. | 
| bundle_min_size | integer | readwrite | Min bundle size. Applicable for bundle-type products only. | 
| bundle_max_size | integer | readwrite | Max bundle size. Applicable for bundle-type products only. | 
| bundle_stock_status | string | read | Stock status of this bundle, taking bundled product quantity requirements and limitations into account. Applicable for bundle-type products only. Read only. Values: instock,outofstock,insufficientstock. | 
| bundle_stock_quantity | integer | read | Quantity of bundles left in stock, taking bundled product quantity requirements into account. Applicable for bundle-type products only. Read only. | 
| bundled_items | array | readwrite 1 | List of bundled items contained in this product. See Bundled Item Properties. | 
| 1 writecontext requires WooCommerce v3.0+ and Product Bundles v5.2+. | |||
Bundled Item Properties
| Attribute | Type | Context | Description | 
|---|---|---|---|
| id | integer | read | Bundled item ID. | 
| delete | boolean | write 1 | Set to trueto delete the bundled item with the specified ID. | 
| product_id | integer | readwrite 1 | Bundled product ID. | 
| menu_order | integer | readwrite 1 | Bundled item menu order. | 
| quantity_min | integer | readwrite 1 | Minimum bundled item quantity. | 
| quantity_max | integer | readwrite 1 | Maximum bundled item quantity. | 
| priced_individually | boolean | readwrite 1 | Indicates whether the price of this bundled item is added to the base price of the bundle. | 
| shipped_individually | boolean | readwrite 1 | Indicates whether the bundled product is shipped separately from the bundle. | 
| override_title | boolean | readwrite 1 | Indicates whether the title of the bundled product is overridden in front-end and e-mail templates. | 
| title | string | readwrite 1 | Title of the bundled product to display instead of the original product title, if overridden. | 
| override_description | boolean | readwrite 1 | Indicates whether the short description of the bundled product is overridden in front-end templates. | 
| description | string | readwrite 1 | Short description of the bundled product to display instead of the original product short description, if overridden. | 
| optional | boolean | readwrite 1 | Indicates whether the bundled item is optional. | 
| hide_thumbnail | boolean | readwrite 1 | Indicates whether the bundled product thumbnail is hidden in the single-product template. | 
| discount | string | readwrite 1 | Discount applied to the bundled product, applicable when the Priced Individually option is enabled. | 
| override_variations | boolean | readwrite 1 | Indicates whether variations filtering is active, applicable for variable bundled products only. | 
| allowed_variations | array | readwrite 1 | List of enabled variation IDs, applicable when variations filtering is active. | 
| override_default_variation_attributes | boolean | readwrite 1 | Indicates whether the default variation attribute values are overridden, applicable for variable bundled products only. | 
| default_variation_attributes | array | readwrite 1 | Overridden default variation attribute values, if applicable. See Default Attribute Properties. | 
| single_product_visibility | string | readwrite 1 | Indicates whether the bundled product is visible in the single-product template. Values: visible,hidden. | 
| cart_visibility | string | readwrite 1 | Indicates whether the bundled product is visible in cart templates. Values: visible,hidden. | 
| order_visibility | string | readwrite 1 | Indicates whether the bundled product is visible in order/e-mail templates. Values: visible,hidden. | 
| single_product_price_visibility | string | readwrite 1 | Indicates whether the bundled product price is visible in the single-product template. Applicable when the Priced Individually option is enabled. Values: visible,hidden. | 
| cart_price_visibility | string | readwrite 1 | Indicates whether the bundled product price is visible in cart templates. Applicable when the Priced Individually option is enabled. Values: visible,hidden. | 
| order_price_visibility | string | readwrite 1 | Indicates whether the bundled product price is visible in order/e-mail templates. Applicable when the Priced Individually option is enabled. Values: visible,hidden. | 
| stock_status | string | read | Stock status of the bundled item, taking minimum quantity into account. Values: in_stock,on_backorder,out_of_stock. | 
| 1 writecontext requires WooCommerce v3.0+ and Product Bundles v5.2+. | |||
Default Attribute Properties
| Attribute | Type | Context | Description | 
|---|---|---|---|
| id | integer | readwrite 1 | Attribute ID. | 
| name | string | readwrite 1 | Attribute name. | 
| option | string | readwrite 1 | Selected attribute term name. | 
| 1 writecontext requires WooCommerce v3.0+ and Product Bundles v5.2+. | |||
Working with Products: Examples
↑ Back to topCreate Bundle
Add Bundled Item
Modify Bundled Item
Delete Bundled Item
Orders
↑ Back to topLine Item Properties
↑ Back to top| Attribute | Type | Context | Description | 
|---|---|---|---|
| bundled_by | string | read | Item ID of parent line item, applicable if the item is part of a bundle. | 
| bundled_items | array | read | Item IDs of bundled line items, applicable if the item is a bundle container item. | 
| bundled_item_title | string | readwrite 1 | Title of the bundled product to display in order/e-mail templates instead of the original product title. | 
| bundle_configuration | string | write 1 | Bundle configuration array. Must be defined when adding a bundle-type line item to an order, to ensure bundled line items are added to the order as well. See Bundle Configuration Properties. | 
| 1 writecontext requires WooCommerce v3.0+ and Product Bundles v5.2+. | |||
Bundle Configuration Properties
| Attribute | Type | Context | Description | 
|---|---|---|---|
| bundled_item_id | integer | write 1 | Bundled item ID. | 
| product_id | integer | write 1 | Bundled product ID. | 
| quantity | integer | write 1 | Bundled product quantity. | 
| title | string | write 1 | Title of the bundled product to display in e-mail/order templates instead of the original product title, if overridden. | 
| optional_selected | boolean | write 1 | Indicates whether the bundled product is selected. Applicable to optional bundled items. | 
| variation_id | integer | write 1 | Chosen variation ID, if applicable. | 
| attributes | array | write 1 | Chosen variation attributes, if applicable. See Variation Attribute Properties. | 
| args | object | write 1 | Additional arguments to pass into WC_Order::add_product, if applicable. | 
| 1 writecontext requires WooCommerce v3.0+ and Product Bundles v5.2+. | |||
Variation Attribute Properties
| Attribute | Type | Context | Description | 
|---|---|---|---|
| name | string | write 1 | Variation attribute name or slug. | 
| option | string | write 1 | Selected variation attribute option name. | 
| 1 writecontext requires WooCommerce v3.0+ and Product Bundles v5.2+. | |||
Working with Orders: Examples
↑ Back to topAdd Bundle to Order
Store API
↑ Back to topProduct Bundles 8.3.0 added support for Store API cart/add-item, cart/update-item and cart/remove-item endpoints to allow updating cart via Store API programmatically.
To support these endpoints, Product Bundles 8.5.0 extended the products Store API endpoint‘s extensions property to include all the essential product bundles information, including the bundle_item_id.
response.txt content:
"extensions": {
    "bundles": {
      "bundle_stock_status": "instock",
      "bundle_stock_quantity": 15,
      "bundle_virtual": false,
      "bundle_layout": "default",
      "bundle_add_to_cart_form_location": "default",
      "bundle_editable_in_cart": true,
      "bundle_sold_individually_context": "product",
      "bundle_item_grouping": "parent",
      "bundle_min_size": "",
      "bundle_max_size": "",
      "bundle_price": {
        "price": {
          "min": {
            "incl_tax": "5640",
            "excl_tax": "4700"
          },
          "max": {
            "incl_tax": "34800",
            "excl_tax": "29000"
          }
        },
        "regular_price": {
          "min": {
            "incl_tax": "5640",
            "excl_tax": "4700"
          },
          "max": {
            "incl_tax": "38040",
            "excl_tax": "31700"
          }
        },
        "currency_code": "DKK",
        "currency_symbol": "kr.",
        "currency_minor_unit": 2,
        "currency_decimal_separator": ",",
        "currency_thousand_separator": ".",
        "currency_prefix": "",
        "currency_suffix": " kr."
      },
      "bundled_items": [
        {
          "bundled_item_id": 1,
          "product_id": 133,
          "menu_order": 0,
          "quantity_min": 3,
          "quantity_max": 9,
          "quantity_default": 3,
          "priced_individually": true,
          "shipped_individually": false,
          "override_title": false,
          "title": "Peanuts",
          "override_description": false,
          "description": "",
          "optional": true,
          "hide_thumbnail": false,
          "discount": "10",
          "override_variations": false,
          "allowed_variations": [],
          "override_default_variation_attributes": false,
          "default_variation_attributes": [],
          "single_product_visibility": "visible",
          "cart_visibility": "visible",
          "order_visibility": "visible",
          "single_product_price_visibility": "visible",
          "cart_price_visibility": "visible",
          "order_price_visibility": "visible",
          "stock_status": "in_stock"
        },
        {
          "bundled_item_id": 2,
          "product_id": 136,
          "menu_order": 1,
          "quantity_min": 2,
          "quantity_max": 8,
          "quantity_default": 4,
          "priced_individually": false,
          "shipped_individually": false,
          "override_title": false,
          "title": "Almonds",
          "override_description": false,
          "description": "",
          "optional": false,
          "hide_thumbnail": false,
          "discount": "",
          "override_variations": true,
          "allowed_variations": [
            139,
            140
          ],
          "override_default_variation_attributes": false,
          "default_variation_attributes": [],
          "single_product_visibility": "visible",
          "cart_visibility": "visible",
          "order_visibility": "visible",
          "single_product_price_visibility": "visible",
          "cart_price_visibility": "visible",
          "order_price_visibility": "visible",
          "stock_status": "in_stock"
        },
        {
          "bundled_item_id": 3,
          "product_id": 134,
          "menu_order": 2,
          "quantity_min": 1,
          "quantity_max": 10,
          "quantity_default": 2,
          "priced_individually": false,
          "shipped_individually": false,
          "override_title": false,
          "title": "Cashews",
          "override_description": false,
          "description": "",
          "optional": false,
          "hide_thumbnail": false,
          "discount": "",
          "override_variations": false,
          "allowed_variations": [],
          "override_default_variation_attributes": false,
          "default_variation_attributes": [],
          "single_product_visibility": "visible",
          "cart_visibility": "visible",
          "order_visibility": "visible",
          "single_product_price_visibility": "visible",
          "cart_price_visibility": "visible",
          "order_price_visibility": "visible",
          "stock_status": "in_stock"
        }
      ]
    }
  }
Add Item
↑ Back to topUpdate Item
↑ Back to topQuestions & Support
↑ Back to topHave a question before you buy? Please fill out this pre-sales form.
Already purchased and need assistance? Get in touch with us via the Help Desk!