Actions Reference

This page is written for WooCommerce developers looking to extend or customize WooCommerce Composite Products. It requires an advanced understanding of PHP and WordPress development.

Summary ↑ Back to top

This guide documents the most useful action hooks available in Composite Products. It is not an exhaustive reference of all available actions and does not include tutorials on how to achieve certain tasks. However, some actions are accompanied by links to snippets or mini-extensions that utilize them.

We recommend reading Data Structures and Storage and keeping the Functions Reference handy. Take time to familiarize yourself with the plugin architecture and the objects relevant to the hook you want to use.

Product Actions Summary ↑ Back to top

Name Description
woocommerce_composite_synced Fired after initializing a WC_Product_Composite object.
woocommerce_composite_products_apply_product_filters Fired after all price filters applied to a product that is part of a composite have been added.
woocommerce_composite_products_remove_product_filters Fired after all price filters applied to a product that is part of a composite have been removed.
woocommerce_composite_component_query_start Fired before executing a WC_CP_Query component options query.
woocommerce_composite_component_query_end Fired after executing a WC_CP_Query component options query.

Template Actions Summary ↑ Back to top

Name Description
woocommerce_composite_before_components Runs once before displaying all component-related content in the single-product add-to-cart template of a composite-type product.
woocommerce_composite_before_components_single1
woocommerce_composite_before_components_progressive2
woocommerce_composite_before_components_paged3
Runs once before displaying all component-related content in the single-product add-to-cart template of a composite-type product. Layout-specific:

1  Single layout only.
2  Progressive layout only.
3  Stepped and Componentized layout only.

woocommerce_composite_after_components Runs once after displaying all component-related content in the single-product add-to-cart template of a composite-type product.
woocommerce_composite_after_components_single1
woocommerce_composite_after_components_progressive2
woocommerce_composite_after_components_paged3
Runs once after displaying all component-related content in the single-product add-to-cart template of a composite-type product. Layout-specific:

1  Single layout only.
2  Progressive layout only.
3  Stepped and Componentized layout only.

woocommerce_composite_component_selections_single1
woocommerce_composite_component_selections_progressive2
woocommerce_composite_component_selections_paged3
Renders all component options content. Layout-specific:

1  Single layout only.
2  Progressive layout only.
3  Stepped and Componentized layout only.

woocommerce_composite_component_options_dropdowns1
woocommerce_composite_component_options_thumbnails2
woocommerce_composite_component_options_radios3
Renders component options associated with a specific style:

1  Dropdown style.
2  Thumbnails style.
3  Radio Buttons style.

woocommerce_composite_add_to_cart_button Renders the composite product quantity and add-to-cart button templates.
woocommerce_composite_show_composited_product Renders the chosen component option content.

Cart Actions Summary ↑ Back to top

Name Description
woocommerce_composited_add_to_cart Fired after adding a composite child product to the cart.
woocommerce_composited_product_before_add_to_cart Fired before adding a composite child product to the cart.
woocommerce_composited_product_after_add_to_cart Fired after adding a composite child product to the cart and the composite_children field of its parent item has been updated.

Order Actions Summary ↑ Back to top

Name Description
woocommerce_composite_component_add_to_order Fired in add_composite_to_order after the child product associated with a component has been added to an order.

Admin Actions Summary ↑ Back to top

Name Description
woocommerce_composite_component_admin_html Outputs all component settings tabs and fields (Basic Settings and Advanced Settings).
woocommerce_composite_component_admin_config_html Outputs all component settings fields in the Basic Settings section.
woocommerce_composite_component_admin_advanced_html Outputs all component settings fields in the Advanced Settings section.
woocommerce_composite_scenario_admin_info_html Outputs all scenario settings fields that appear under the Scenario Name & Description section.
woocommerce_composite_scenario_admin_config_html Outputs all scenario settings fields that appear under the Scenario Configuration section.
woocommerce_composite_scenario_admin_actions_html Outputs all scenario settings fields that appear under the Scenario Actions section.
woocommerce_composite_component_admin_config_filter_options Fired after displaying the component filtering options in the Advanced Settings section.
woocommerce_composite_component_admin_config_query_options Fired after displaying the component options query type settings in the Basic Settings section.

Product Actions ↑ Back to top

 

woocommerce_composite_synced

Description

Fired after initializing a WC_Product_Composite object.

Arguments

WC_Product_Composite $composite – Composite product object.


 

woocommerce_composite_products_apply_product_filters

Description

Fired after all price filters applied to a product that is part of a composite have been added.

Arguments

WC_Product $product – Product object.
string $component_id – Component ID.
WC_Product_Composite $composite – Composite product object.


 

woocommerce_composite_products_remove_product_filters

Description

Fired after all price filters applied to a product that is part of a composite have been added.

Arguments


 

woocommerce_composite_component_query_start

Description

Fired before executing a WC_CP_Query component options query.

Arguments

array $component_data – Array containing component configuration data.
array $query_args – Component options query arguments, such as orderby, per_page, load_page and selected_option. For details, see the WC_CP_Query class inline documentation.


 

woocommerce_composite_component_query_end

Description

Fired after executing a WC_CP_Query component options query.

Arguments

array $component_data – Array containing component configuration data.
array $query_args – Component options query arguments, such as orderby, per_page, load_page and selected_option. For details, see the WC_CP_Query class inline documentation.

 

Template Actions ↑ Back to top

 

woocommerce_composite_before_components

Description

Runs once before displaying all component-related content in the single-product add-to-cart template of a composite-type product.

Arguments

array $components – Array of WC_CP_Component objects.
WC_Product_Composite $composite – Composite product object.


 

woocommerce_composite_before_components_single

woocommerce_composite_before_components_progressive

woocommerce_composite_before_components_paged

Description

Runs once before displaying all component-related content in the single-product add-to-cart template of a composite-type product. Layout-specific:

woocommerce_composite_before_components_singleSingle layout only.
woocommerce_composite_before_components_progressiveProgressive layout only.
woocommerce_composite_before_components_pagedStepped and Componentized layout only.

Arguments

array $components – Array of WC_CP_Component objects.
WC_Product_Composite $composite – Composite product object.


 

woocommerce_composite_after_components

Description

Runs once after displaying all component-related content in the single-product add-to-cart template of a composite-type product.

Arguments

array $components – Array of WC_CP_Component objects.
WC_Product_Composite $composite – Composite product object.


 

woocommerce_composite_after_components_single

woocommerce_composite_after_components_progressive

woocommerce_composite_after_components_paged

Description

Runs once after displaying all component-related content in the single-product add-to-cart template of a composite-type product. Layout-specific:

woocommerce_composite_after_components_singleSingle layout only.
woocommerce_composite_after_components_progressiveProgressive layout only.
woocommerce_composite_after_components_pagedStepped and Componentized layout only.

Arguments

array $components – Array of WC_CP_Component objects.
WC_Product_Composite $composite – Composite product object.


 

woocommerce_composite_component_selections_single

woocommerce_composite_component_selections_progressive

woocommerce_composite_component_selections_paged

Description

Renders all component options content. Layout-specific:

woocommerce_composite_component_selections_singleSingle layout only.
woocommerce_composite_component_selections_progressiveProgressive layout only.
woocommerce_composite_component_selections_pagedStepped and Componentized layout only.

Arguments

string $component_id – Component ID.
WC_Product_Composite $composite – Composite product object.


 

woocommerce_composite_component_options_dropdowns

woocommerce_composite_component_options_thumbnails

woocommerce_composite_component_options_radios

Description

Renders component options associated with a specific style:

woocommerce_composite_component_options_dropdownsDropdown style only.
woocommerce_composite_component_options_thumbnailsThumbnails style only.
woocommerce_composite_component_options_radiosRadio Buttons style only.

Arguments

string $component_id – Component ID.
WC_Product_Composite $composite – Composite product object.


 

woocommerce_composite_add_to_cart_button

Description

Renders the composite product quantity and add-to-cart button templates.

Arguments


 

woocommerce_composite_show_composited_product

Description

Renders the chosen component option content.

Arguments

WC_Product $product – Chosen product object.
string $component_id – Component ID.
WC_Product_Composite $composite – Composite product object.

 

Cart Actions ↑ Back to top

 

woocommerce_composited_add_to_cart

Description

Fired after adding a composite child product to the cart.

Arguments

string $cart_item_key – Child cart item key.
integer $product_id – Child product ID.
integer $quantity – Child product quantity.
integer|'' $variation_id – Child product variation ID, if applicable.
array $variation_data – Child product variation attributes data, if applicable.
array $cart_item_data – Additional child cart item fields.
integer $composite_id – Composite product ID.


 

woocommerce_composited_product_before_add_to_cart

Description

Fired before adding a composite child product to the cart.

Arguments

integer $product_id – Child product ID.
integer $quantity – Child product quantity.
integer|'' $variation_id – Child product variation ID, if applicable.
array $variation_data – Child product variation attributes data, if applicable.
array $cart_item_data – Additional child cart item fields.


 

woocommerce_composited_product_after_add_to_cart

Description

Fired after adding a composite child product to the cart and the composite_children field of its parent item has been updated.

Arguments

integer $product_id – Child product ID.
integer $quantity – Child product quantity.
integer|'' $variation_id – Child product variation ID, if applicable.
array $variation_data – Child product variation attributes data, if applicable.
array $cart_item_data – Additional child cart item fields.

 

Order Actions ↑ Back to top

 

woocommerce_composite_component_add_to_order

Description

Fired in add_composite_to_order after the child product associated with a component has been added to an order.

Arguments

string $component_id – Component ID.
WC_Order $order – Order object.
WC_Product $quantity – Child product chosen in component.
integer $component_quantity – Quantity of the child product.
WC_CP_Component $component – Component object.
WC_Product_Composite $bundle – Composite product object.
integer $quantity – Quantity of the bundle.
array $component_args – Component args passed to the WC_Order::add_product function.
array $args – Args passed to the add_composite_to_order function.

 

Admin Actions ↑ Back to top

 

woocommerce_composite_component_admin_html

Description

Outputs all component settings tabs/sections and fields (Basic Settings and Advanced Settings).

Arguments

integer $loop – Index of component.
array $component_data – Component configuration data array.
integer $post_id – Composite product ID.
string $state – Box state (open|closed).


 

woocommerce_composite_component_admin_config_html

Description

Outputs all component settings fields in the Basic Settings section.

Arguments

integer $loop – Index of component.
array $component_data – Component configuration data array.
integer $post_id – Composite product ID.


 

woocommerce_composite_component_admin_advanced_html

Description

Outputs all component settings fields in the Advanced Settings section.

Arguments

integer $loop – Index of component.
array $component_data – Component configuration data array.
integer $post_id – Composite product ID.


 

woocommerce_composite_scenario_admin_info_html

Description

Outputs all scenario settings fields that appear under the Scenario Name & Description section.

Arguments

integer $loop – Index of component.
array $scenario_data – Scenario configuration data array.
array $components_data – Array of component configuration data arrays.
integer $post_id – Composite product ID.


 

woocommerce_composite_scenario_admin_config_html

Description

Outputs all scenario settings fields that appear under the Scenario Configuration section.

Arguments

integer $loop – Index of component.
array $scenario_data – Scenario configuration data array.
array $components_data – Array of component configuration data arrays.
integer $post_id – Composite product ID.


 

woocommerce_composite_scenario_admin_actions_html

Description

Outputs all scenario settings fields that appear under the Scenario Actions section.

Arguments

integer $loop – Index of component.
array $scenario_data – Scenario configuration data array.
array $components_data – Array of component configuration data arrays.
integer $post_id – Composite product ID.


 

woocommerce_composite_component_admin_config_filter_options

Description

Fired after displaying the component filtering options in the Advanced Settings section.

Arguments

integer $loop – Index of component.
array $component_data – Component configuration data array.
integer $post_id – Composite product ID.


 

woocommerce_composite_component_admin_config_query_options

Description

Fired after displaying the component options query type settings in the Basic Settings section.

Arguments

integer $loop – Index of component.
array $component_data – Component configuration data array.
integer $post_id – Composite product ID.

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

Back to the top