This page is written for WooCommerce developers looking to extend or customize WooCommerce Product Bundles. It requires an advanced understanding of PHP and WordPress development.
Summary
↑ Back to topThis guide documents the most useful action hooks available in Product Bundles. It is not an exhaustive reference of all available actions and does not include tutorials on how to achieve certain tasks.
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 topName | Description |
---|---|
woocommerce_bundles_synced_bundle | Fired after initializing a WC_Product_Bundle object. |
woocommerce_bundled_product_price_filters_added | Fired after all price filters associated with a bundled product have been applied. |
woocommerce_bundled_product_price_filters_removed | Fired after all price filters associated with a bundled product have been removed. |
woocommerce_new_bundled_item | Database layer hook, fired when a new bundled item is created in the database. |
woocommerce_update_bundled_item | Database layer hook, fired when a bundled item is updated in the database. |
woocommerce_before_delete_bundled_item | Database layer hook, fired before deleting a bundled item from the database. |
woocommerce_delete_bundled_item | Database layer hook, fired after deleting a bundled item from the database. |
Template Actions Summary
↑ Back to topName | Description |
---|---|
woocommerce_before_bundled_items | The first action to be fired in the single-product add-to-cart template of a bundle-type product, before displaying any bundled item content. |
woocommerce_after_bundled_items | Fired after all bundled item content has been displayed in the single-product add-to-cart template of a bundle-type product. |
woocommerce_bundles_add_to_cart_button | Used for rendering the single-product quantity field and add-to-cart button of a bundle-type product. |
woocommerce_bundled_item_details | Fired in the single-product add-to-cart template of a bundle-type product. Used to render all bundled product template parts associated with a single bundled item. |
woocommerce_bundled_product_add_to_cart | Located in bundled product templates, this hook is useful for rendering content normally hooked to the woocommerce_before_add_to_cart_button action, such as Product Add-ons fields. |
woocommerce_bundled_single_variation | Bundled product template hook used for rendering variation content of variable-type products. |
woocommerce_after_bundled_item_cart_details | Bundled product template hook fired after all form content associated with a single bundled product has been rendered. |
Cart Actions Summary
↑ Back to topName | Description |
---|---|
woocommerce_bundled_add_to_cart | Fired after adding a bundled product to the cart. |
woocommerce_bundled_item_before_add_to_cart | Fired before adding a bundled product to the cart. |
woocommerce_bundled_item_after_add_to_cart | Fired after a bundled product has been added to the cart and the bundled_items field of its parent item has been updated. |
Order Actions Summary
↑ Back to topName | Description |
---|---|
woocommerce_bundled_add_to_order | Fired in add_bundle_to_order after a bundled product has been added to an order. |
Admin Actions Summary
↑ Back to topName | Description |
---|---|
woocommerce_bundled_products_admin_config | Used to render the Bundled Products panel content in edit-product pages. |
woocommerce_bundled_product_admin_*_html | Used to render the tab contents of bundled item options (located in the Bundled Products panel of edit-product pages). |
Product Actions
↑ Back to topwoocommerce_bundles_synced_bundle
Description
Fired after initializing a WC_Product_Bundle
object.
Arguments
WC_Product_Bundle $bundle
– Product bundle object.
woocommerce_bundled_product_price_filters_added
Description
Fired after all price filters associated with a bundled product have been applied.
Arguments
WC_Bundled_Item $bundled_item
– Bundled item object.
woocommerce_bundled_product_price_filters_added
Description
Fired after all price filters associated with a bundled product have been applied.
Arguments
WC_Bundled_Item $bundled_item
– Bundled item object.
woocommerce_bundled_product_price_filters_removed
Description
Fired after all price filters associated with a bundled product have been removed.
Arguments
WC_Bundled_Item $bundled_item
– Bundled item object.
woocommerce_new_bundled_item
Description
Database layer hook, fired when a bundled item is created in the database.
Arguments
WC_Bundled_Item $bundled_item
– Bundled item object.
woocommerce_update_bundled_item
Description
Database layer hook, fired when a bundled item is updated in the database.
Arguments
WC_Bundled_Item $bundled_item
– Bundled item object.
woocommerce_before_delete_bundled_item
Description
Database layer hook, fired before deleting a bundled item from the database.
Arguments
WC_Bundled_Item $bundled_item
– Bundled item object.
woocommerce_delete_bundled_item
Description
Database layer hook, fired after deleting a bundled item from the database.
Arguments
WC_Bundled_Item $bundled_item
– Bundled item object.
Template Actions
↑ Back to topwoocommerce_before_bundled_items
Description
The first action to be fired in the single-product add-to-cart template of a bundle-type product, before displaying any bundled item content.
Arguments
WC_Product_Bundle $bundle
– Product bundle object.
woocommerce_after_bundled_items
Description
Fired after all bundled item content has been displayed in the single-product add-to-cart template of a bundle-type product.
Arguments
WC_Product_Bundle $bundle
– Product bundle object.
woocommerce_bundles_add_to_cart_button
Description
Used for rendering the single-product quantity field and add-to-cart button of a bundle-type product.
Arguments
void
woocommerce_bundled_item_details
Description
Fired in the single-product add-to-cart template of a bundle-type product. Used to render all bundled product template parts associated with a single bundled item.
Arguments
WC_Bundled_Item $bundled_item
– Bundled item object.WC_Product_Bundle $bundle
– Product bundle object.
woocommerce_bundled_product_add_to_cart
Description
Located in bundled product templates, this hook is useful for rendering content normally hooked to the woocommerce_before_add_to_cart_button
action, such as Product Add-ons fields.
Arguments
integer $product_id
– Bundled product ID.WC_Bundled_Item $bundle
– Bundled item object.
Examples
The use of this action is demonstrated in the WC_PB_Addons_Compatibility
class included in Product Bundles, which contains compatibility code for the Product Add-ons extension. The hook is used to render Add-Ons fields associated with the bundled product.
woocommerce_bundled_single_variation
Description
Bundled product template hook used for rendering variation content of variable-type bundled products.
Arguments
integer $product_id
– Bundled product ID.WC_Bundled_Item $bundle
– Bundled item object.
woocommerce_after_bundled_item_cart_details
Description
Bundled product template hook fired after all form content associated with a single bundled product has been rendered.
Arguments
WC_Bundled_Item $bundle
– Bundled item object.
Cart Actions
↑ Back to topwoocommerce_bundled_add_to_cart
Description
Fired after adding a bundled product to the cart.
Arguments
string $cart_item_key
– Bundled cart item key.integer $product_id
– Bundled product ID.integer $quantity
– Bundled product quantity.integer|'' $variation_id
– Bundled product variation ID, if applicable.array $variation_data
– Bundled product variation attributes data, if applicable.array $cart_item_data
– Extension-specific bundled cart item fields.integer $bundle_id
– Product bundle ID.
woocommerce_bundled_item_before_add_to_cart
Description
Fired before adding a bundled product to the cart.
Arguments
integer $product_id
– Bundled product ID.integer $quantity
– Bundled product quantity.integer|'' $variation_id
– Bundled product variation ID, if applicable.array $variation_data
– Bundled product variation attributes data, if applicable.array $cart_item_data
– Extension-specific fields to add to the bundled cart item.
woocommerce_bundled_item_after_add_to_cart
Description
Fired after a bundled product has been added to the cart and its parent cart item has been updated.
Arguments
integer $product_id
– Bundled product ID.integer $quantity
– Bundled product quantity.integer|'' $variation_id
– Bundled product variation ID, if applicable.array $variation_data
– Bundled product variation attributes data, if applicable.array $cart_item_data
– Extension-specific fields to add to the bundled cart item.
Order Actions
↑ Back to topwoocommerce_bundled_add_to_order
Description
Fired in add_bundle_to_order after a bundled product has been added to an order.
Arguments
integer $bundled_order_item_id
– Bundled product order item ID.WC_Order $order
– Order object.WC_Product $quantity
– Bundled product.integer $bundled_item_quantity
– Quantity of the item in the bundle.WC_Bundled_Item $bundled_item
– Bundled item object.WC_Product_Bundle $bundle
– Product bundle object.integer $bundled_item_quantity
– Quantity of the bundle.array $bundled_item_args
– Bundled product args passed to the WC_Order::add_product
function.array $args
– Args passed to the add_bundle_to_order
function.
Admin Actions
↑ Back to topwoocommerce_bundled_products_admin_config
Description
Used to render the Bundled Products panel content in edit-product pages.
Arguments
void
woocommerce_bundled_product_admin_*_html
Description
Used to render the tab contents of bundled item options (located in the Bundled Products panel of edit-product pages).
Arguments
integer $loop
– Index of bundled item.integer $product_id
– Bundled product ID.array $bundled_item_data
– Bundled item data array.integer $post_id
– Product bundle ID.
Questions & 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!