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.
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 packaged items ↑ Back to top
By default, the weight of a non-virtual bundle is assumed to be static and equal to the value entered in its Weight field, even when the bundle contains bundled products that are not Shipped Individually.
In some cases, it might be desirable to use the value defined in the Weight field as a base bundle weight and have the weight of all packaged bundled items added to this base weight.
This is possible by using the
Change the way item subtotals appear in the cart/orders ↑ Back to top
By default, the cart item subtotal of a bundle container item is calculated as the sum of the base/static bundle price subtotal + the subtotals of any bundled items that are priced individually, while the subtotals of individually-priced items are displayed with a ‘Subtotal:’ prefix.
To prevent this behavior, use the following snippet/plugin: