1. Documentation /
  2. REST API Reference

REST API Reference

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_by lists all product bundle IDs that a product has been added to, while bundled_items lists the bundled item data associated with a product of the bundle type.
  • In order context, bundled_by is applicable to bundled order items and references the order item ID of their parent, while bundled_items is applicable to bundle parent items and lists the associated bundled line item IDs.

Products

↑ Back to top

Product Properties

↑ Back to top
Attribute Type Context Description
bundled_by array read List of product bundle IDs that contain this product.
bundle_virtual boolean read write Forces all contents of this bundle to be treated as virtual.
bundle_layout string read write Single-product details page layout. Applicable for bundle-type products only.

Values: default, tabular.
bundle_add_to_cart_form_location string read write 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 read write Controls whether the configuration of this product can be modified from the cart page. Applicable to bundle-type products.
bundle_item_grouping string read write 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 read write Min bundle size. Applicable for bundle-type products only.
bundle_max_size integer read write 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 read write 1 List of bundled items contained in this product. See Bundled Item Properties.
1 write context 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 true to delete the bundled item with the specified ID.
product_id integer read write 1 Bundled product ID.
menu_order integer read write 1 Bundled item menu order.
quantity_min integer read write 1 Minimum bundled item quantity.
quantity_max integer read write 1 Maximum bundled item quantity.
priced_individually boolean read write 1 Indicates whether the price of this bundled item is added to the base price of the bundle.
shipped_individually boolean read write 1 Indicates whether the bundled product is shipped separately from the bundle.
override_title boolean read write 1 Indicates whether the title of the bundled product is overridden in front-end and e-mail templates.
title string read write 1 Title of the bundled product to display instead of the original product title, if overridden.
override_description boolean read write 1 Indicates whether the short description of the bundled product is overridden in front-end templates.
description string read write 1 Short description of the bundled product to display instead of the original product short description, if overridden.
optional boolean read write 1 Indicates whether the bundled item is optional.
hide_thumbnail boolean read write 1 Indicates whether the bundled product thumbnail is hidden in the single-product template.
discount string read write 1 Discount applied to the bundled product, applicable when the Priced Individually option is enabled.
override_variations boolean read write 1 Indicates whether variations filtering is active, applicable for variable bundled products only.
allowed_variations array read write 1 List of enabled variation IDs, applicable when variations filtering is active.
override_default_variation_attributes boolean read write 1 Indicates whether the default variation attribute values are overridden, applicable for variable bundled products only.
default_variation_attributes array read write 1 Overridden default variation attribute values, if applicable. See Default Attribute Properties.
single_product_visibility string read write 1 Indicates whether the bundled product is visible in the single-product template. Values: visible, hidden.
cart_visibility string read write 1 Indicates whether the bundled product is visible in cart templates. Values: visible, hidden.
order_visibility string read write 1 Indicates whether the bundled product is visible in order/e-mail templates. Values: visible, hidden.
single_product_price_visibility string read write 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 read write 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 read write 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 write context requires WooCommerce v3.0+ and Product Bundles v5.2+.

Default Attribute Properties

Attribute Type Context Description
id integer read write 1 Attribute ID.
name string read write 1 Attribute name.
option string read write 1 Selected attribute term name.
1 write context requires WooCommerce v3.0+ and Product Bundles v5.2+.

Working with Products: Examples

↑ Back to top

Create Bundle

View on Github

Add Bundled Item

View on Github

Modify Bundled Item

View on Github

Delete Bundled Item

View on Github

Orders

↑ Back to top

Line 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 read write 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 write context 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 write context 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 write context requires WooCommerce v3.0+ and Product Bundles v5.2+.

Working with Orders: Examples

↑ Back to top

Add Bundle to Order

View on Github

Questions & Support

↑ Back to top

Have 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!