Tips, Tricks and Snippets

Use these snippets to customize the appearance and functionality of WooCommerce Product Bundles.

To use a snippet, download the linked file and activate it as you would with any other plugin. Alternatively, copy the contained code into your child theme’s functions.php file.

Note: We are unable to provide support for customizations under our Support Policy. If you are unfamiliar with code/templates and resolving potential conflicts, select a WooExpert or Developer for assistance.

Snippets ↑ Back to top

Make optional bundled items checked/selected by default ↑ Back to top

By default, optional bundled item checkboxes are unticked by default. This can be changed with the following snippet:

 

Remove the “optional” suffix from optional bundled item titles ↑ Back to top

By default, the extension adds an “- optional” suffix next to the title of bundled items that have been marked as optional. To remove this suffix, use the following snippet/plugin:

 

Override the default bundled item quantity value ↑ Back to top

By default, the quantity field of every bundled product is initialized with a value equal to the Minimum Quantity. This behavior can be changed by using the following snippet/plugin, which assumes a bundle ID equal to 1000 and a bundled item ID equal to 500 (change these values as required).

 

Define quantity constraints (min/max) for the total amount of selected bundled items ↑ Back to top

Out of the box, Product Bundles does not include options for defining bundled item quantity constraints at bundle-level. Instead it is highly recommended to use WooCommerce Mix ‘n Match, which allows you to define container-level quantity constraints for assortments of grouped products.

Similar functionality can be added to Product Bundles by using the Product Bundles – Min/Max Items mini-extension (not officially supported).

Allow discounts over bundled product sale prices ↑ Back to top

By default, sale prices are ignored when applying bundled item discounts. This behavior can be altered by using the following snippet/plugin:

 

Prevent product bundles price strings from showing up in range-format ↑ Back to top

Ensure that you are using the latest version of Product Bundles, then use the following snippet/plugin:

 

Use a variable bundle weight when a bundle contains assembled items ↑ Back to top

By default, assembled bundles have a static weight, which is defined under Product Data > Shipping > Weight. Assembled bundled items (Shipped Individually disabled) have no effect on the weight of their container.

In some cases, it is desirable to use the value entered in the Weight field as a base container weight, and let each assembled bundled item contribute its own weight to it.

This is possible using the woocommerce_bundled_item_has_bundled_weight filter:

 

Change the appearance of item subtotals in the cart/orders ↑ Back to top

By default, the subtotals of parent/child line items in cart/order templates are added together and the aggregated value is displayed instead of the actual subtotal of the parent item. Additionally, the subtotals of individually-priced items are indented and displayed with a Subtotal: prefix.

To prevent this, use the following snippet/plugin:

 

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!

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

Back to the top