Product Icon

Product Bundles

by  Woo
Offer personalized product bundles, bulk discount packages, and assembled products.

Error when taxes are disabled

There is a bug when taxes are disabled.

The bug is in this file:
An error of type E_ERROR was caused in line 2069 of the file /wp-content/plugins/woocommerce-product-bundles/includes/class-wc-pb-cart.php. Error message: Uncaught TypeError: array_merge(): Argument #1 must be of type array, null given in /wp-content/plugins/woocommerce-product-bundles/includes/class-wc-pb-cart.php:2069
Stack trace:
#0 /wp-content/plugins/woocommerce-product-bundles/includes/class-wc-pb-cart.php(2069): array_merge(NULL, NULL)
#1 /wp-includes/class-wp-hook.php(324): WC_PB_Cart->cart_shipping_packages(Array)

Function: cart_shipping_packages

Affected code:

$bundle_totals[ ‘line_tax_data’ ][ ‘total’ ] = array_merge( $bundle_totals[ ‘line_tax_data’ ][ ‘total’ ], $child_item_line_tax_data[ ‘total’ ] );
$bundle_totals[ ‘line_tax_data’ ][ ‘subtotal’ ] = array_merge( $bundle_totals[ ‘line_tax_data’ ][ ‘subtotal’ ], $child_item_line_tax_data[ ‘subtotal’ ] );

The issue is that when taxes are disabled, $bundle_totals[ ‘line_tax_data’ ][ ‘total’ ] is NULL and then array_merge throws the error.

A possible fix is to coalesce it with an empty array, like this:

$bundle_totals[ ‘line_tax_data’ ][ ‘total’ ] = array_merge( $bundle_totals[ ‘line_tax_data’ ][ ‘total’ ] ?? [], $child_item_line_tax_data[ ‘total’ ] ?? [] );
$bundle_totals[ ‘line_tax_data’ ][ ‘subtotal’ ] = array_merge( $bundle_totals[ ‘line_tax_data’ ][ ‘subtotal’ ] ?? [], $child_item_line_tax_data[ ‘subtotal’ ] ?? [] );


Current Status


Last updated: January 2, 2024


Log in to comment on this feature request.

  1. says:

    Hey Orhan. Thanks for the reply. I’m going to create a minimal testcase. I’ll get back to you shortly.

  2. orhanf says:


    Orhan from here, nice to be connecting. : )

    Product Bundles has a suite of automated acceptance tests that validate most of the plugin’s main flows, such as adding a Bundle to the cart and viewing its totals, both with taxes enabled and disabled. Also, our team manually runs tests in our local sites almost daily both with taxes enabled and disabled and we haven’t seen any similar error.

    It is very likely that this issue is coming from a plugin/theme conflict. Can you please conduct a conflict test using this guide:

    If the issue persists after the conflict test, do reach out to our support team and reference this feature request URL so we can look into the issue further. You can contact us from here: