REST API Reference

This document is written for WooCommerce developers looking to extend or customize WooCommerce Composite Products. 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.

Composite Products extends the /products/ and /orders/ endpoint responses with additional properties that are documented in this guide.

Products ↑ Back to top

Product Properties ↑ Back to top

Attribute Type Context Description
composite_layout string read write Single-product template layout. Applicable to composite-type products. Values: single, progressive, paged, paged-componentized.
composite_components array read write 1 List of components that this product consists of. Applicable to composite-type products. See Component Properties.
composite_scenarios array read write 1 Scenarios configured for this product. Applicable to composite-type products. See Scenario Properties.
1 write context requires WooCommerce v3.0+ and Composite Products v3.9+.

Component Properties

Attribute Type Context Description
id string read Component ID.
delete boolean write 1 Set to true to delete the component with the specified ID.
title string read write 1 Title of the component.
description string read write 1 Description of the component.
query_type string read write 1 Component options query type.
query_ids array read write 1 Product IDs or category IDs to use for populating component options.
default_option_id integer read write 1 The product ID of the default/pre-selected component opion.
thumbnail_id integer read write 1 The attachment ID of the thumbnail associated with this Component.
quantity_min integer read write 1 Minimum component quantity.
quantity_max integer read write 1 Maximum component quantity.
priced_individually boolean read write 1 Indicates whether the price of this component is added to the base price of the composite.
shipped_individually boolean read write 1 Indicates whether this component is shipped separately from the composite.
optional boolean read write 1 Indicates whether the component is optional.
discount string read write 1 Discount applied to the component, applicable when the Priced Individually option is enabled.
options_style string read write 1 Indicates which template/style to use to display component options.
1 write context requires WooCommerce v3.0+ and Composite Products v3.9+.

Scenario Properties

Attribute Type Context Description
id string read Scenario ID.
delete boolean write 1 Set to true to delete the scenario with the specified ID.
name string read write 1 Name of the scenario.
description string read write 1 Optional short description of the scenario.
configuration array read write 1 Matching conditions for components. See Component Matching Condition Properties.
actions array read write 1 Scenario actions. See Scenario Action Properties.
1 write context requires WooCommerce v3.0+ and Composite Products v3.9+.

Component Matching Condition Properties

Attribute Type Context Description
component_id string read write 1 Component ID.
component_options array read write 1 Product/variation IDs in component targeted by the scenario (0 = any product or variation, -1 = no selection).
options_modifier string read write 1 Comparison modifier for the referenced product/variation IDs. Values: in, not-in, masked.
1 write context requires WooCommerce v3.0+ and Composite Products v3.9+.

Scenario Action Properties

Attribute Type Context Description
scenario_id string read write 1 Scenario action ID (by default compat_group or conditional_components).
is_active boolean read write 1 Indicates whether the scenario action is active.
action_data object read write 1 Custom action data.
1 write context requires WooCommerce v3.0+ and Composite Products v3.9+.

Product Endpoint Examples ↑ Back to top

Create Composite

Add Component

Modify Component

Delete Component

Orders ↑ Back to top

Line Item Properties ↑ Back to top

Attribute Type Context Description
composite_parent string read Item ID of parent line item, applicable if the item is part of a composite.
composite_children array read Item IDs of composited/child line items, applicable if the item is a composite container.
composite_configuration string write 1 Composite product configuration array. Must be defined when adding a composite-type line item to an order, to ensure components are added to the order as well. See Composite Configuration Properties.
1 write context requires WooCommerce v3.0+ and Composite Products v3.9+.

Composite Configuration Properties

Attribute Type Context Description
component_id string write 1 Component ID.
product_id integer write 1 Chosen product ID.
quantity integer write 1 Chosen product quantity.
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 Composite Products v3.9+.

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 Composite Products v3.9+.

Order Endpoint Examples ↑ Back to top

Add Composite to Order

WooCommerce - the most customizable eCommerce platform for building your online business.

Back to the top