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.
Product IDs or category IDs to use for populating component options.
default_option_id
integer
readwrite
The product ID of the default/pre-selected component opion.
thumbnail_id
integer
readwrite
The attachment ID of the thumbnail associated with this Component.
thumbnail_src
string
readwrite
URL of the thumbnail associated with this Component.
quantity_min
integer
readwrite
Minimum component quantity.
quantity_max
integer
readwrite
Maximum component quantity.
priced_individually
boolean
readwrite
Indicates whether the price of this component is added to the base price of the composite.
shipped_individually
boolean
readwrite
Indicates whether this component is shipped separately from the composite.
optional
boolean
readwrite
Indicates whether the component is optional.
discount
string
readwrite
Discount applied to the component, applicable when the Priced Individually option is enabled.
options_style
string
readwrite
Indicates which template/style to use to display component options. Values: dropdowns, thumbnails, radios.
pagination_style
string
readwrite
Controls how new Thumbnails are loaded into the Component Options view. Applicable when the Options Style of this Component is set to Thumbnails. Values: classic, load-more.
display_prices
string
readwrite
Controls how Component Option prices are displayed. Applicable when Priced Individually is enabled for this Component. Values: absolute, relative, hidden.
show_sorting_options
boolean
readwrite
Whether to display sorting options in this Component.
show_filtering_options
boolean
readwrite
Whether to display filtering options in this Component.
attribute_filter_ids
array( int )
readwrite
Attribute IDs to use for creating Component Option filters.
product_title_visible
boolean
readwrite
Controls the visibility of product titles in the Component Selection view.
product_descr_visible
boolean
readwrite
Controls the visibility of product short descriptions in the Component Selection view.
product_price_visible
boolean
readwrite
Controls the visibility of product prices in the Component Selection view.
product_thumb_visible
boolean
readwrite
Controls the visibility of product thumbnails in the Component Selection view.
subtotal_visible_product
boolean
readwrite
Controls the visibility of the subtotal associated with this Component in the single-product page.
subtotal_visible_cart
boolean
readwrite
Controls the visibility of the subtotal associated with this Component in the cart page.
subtotal_visible_orders
boolean
readwrite
Controls the visibility of the subtotal associated with this Component in order-related pages and e-mail notifications.
Scenario Properties
Attribute
Type
Context
Description
id
string
read
Scenario ID.
delete
boolean
write
Set to true to delete the scenario with the specified ID.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -X POST https://example.com/wp-json/wc/v2/products \
-u consumer_key:consumer_secret \
-H "Content-Type: application/json" \
-d '{
"name": "Build Your Ninja Outfit",
"type": "composite",
"description": "In pretium enim justo, at ornare libero aliquam quis. Nullam imperdiet rutrum volutpat. Suspendisse aliquet ex in ex volutpat vestibulum. Curabitur ultrices convallis condimentum.",
"short_description": "In pretium enim justo, at ornare libero aliquam quis.",
"description": "Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo.",
"query_type": "category_ids",
"query_ids": [ 14 ],
"quantity_min": 1,
"quantity_max": 1,
"priced_individually": true,
"shipped_individually": false,
"optional": false,
"discount": "20.0",
"options_style": "thumbnails"
},
{
"title": "Your Ninja Hoodie",
"description": "Nullam imperdiet rutrum volutpat. Suspendisse aliquet ex in ex volutpat vestibulum. Curabitur ultrices convallis condimentum.",
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -X PUT https://example.com/wp-json/wc/v2/products/133 \
-u consumer_key:consumer_secret \
-H "Content-Type: application/json" \
-d '{
"composite_components": [
{
"title": "Your Free Poster",
"description": "Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo.",
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
We and our partners process your personal data (such as browsing data, IP Addresses, cookie information, and other unique identifiers) based on your consent and/or our legitimate interest to optimize our website, marketing activities, and your user experience.