diff -u b/commerce_vat.module b/commerce_vat.module --- b/commerce_vat.module +++ b/commerce_vat.module @@ -347,10 +347,13 @@ $component['price']['amount'] -= $amount_to_reduce_current; $amount_to_reduce_left -= $amount_to_reduce_current; } - // Remaining rounding difference deliberately reduces first nonzero component. - $nonzero_components[0]['price']['amount'] -= $amount_to_reduce_left; - $wrapper->commerce_unit_price->data = $data; - $included = TRUE; + // Change components only if there was a nonzero-one. + if (!empty($nonzero_components)) { + // Remaining rounding difference deliberately reduces first nonzero component. + $nonzero_components[0]['price']['amount'] -= $amount_to_reduce_left; + $wrapper->commerce_unit_price->data = $data; + $included = TRUE; + } } else { // Include the vat amount in the displayed unit price.