diff --git a/includes/admin/settings/class-wc-gzd-settings-tab-taxes.php b/includes/admin/settings/class-wc-gzd-settings-tab-taxes.php index 827130868..1d7e2f661 100644 --- a/includes/admin/settings/class-wc-gzd-settings-tab-taxes.php +++ b/includes/admin/settings/class-wc-gzd-settings-tab-taxes.php @@ -135,7 +135,7 @@ protected function get_additional_costs_settings() { 'desc_tip' => true, 'id' => 'woocommerce_gzd_tax_mode_additional_costs', 'type' => 'radio', - 'default' => 'split_tax', + 'default' => 'main_service', 'options' => array( 'none' => __( 'WooCommerce default', 'woocommerce-germanized' ), 'split_tax' => __( 'Proportionate', 'woocommerce-germanized' ), diff --git a/includes/class-wc-gzd-coupon-helper.php b/includes/class-wc-gzd-coupon-helper.php index 579a98a37..fe8974551 100644 --- a/includes/class-wc-gzd-coupon-helper.php +++ b/includes/class-wc-gzd-coupon-helper.php @@ -528,7 +528,7 @@ public function fee_is_voucher( $fee ) { } else { $fee_id = isset( $fee->object ) ? $fee->object->id : $fee->id; - return strstr( $fee_id, 'voucher_' ); + return strstr( str_replace( '-', '_', $fee_id ), 'voucher_' ); } } diff --git a/includes/class-wc-gzd-order-helper.php b/includes/class-wc-gzd-order-helper.php index 8b5e016b8..2bb5649e4 100644 --- a/includes/class-wc-gzd-order-helper.php +++ b/includes/class-wc-gzd-order-helper.php @@ -326,6 +326,28 @@ public function adjust_additional_costs_item_taxes( $item, $calculate_tax_for = return; } + if ( is_a( $item, 'WC_Order_Item_Fee' ) ) { + $fee_props = (object) array( + 'id' => '', + 'name' => '', + 'tax_class' => '', + 'taxable' => false, + 'amount' => 0, + 'total' => 0, + ); + + $fee_props->name = $item->get_name(); + $fee_props->tax_class = $item->get_tax_class(); + $fee_props->taxable = 'taxable' === $item->get_tax_status(); + $fee_props->amount = $item->get_amount(); + $fee_props->id = sanitize_title( $fee_props->name ); + $fee_props->object = $fee_props; + + if ( ! apply_filters( 'woocommerce_gzd_force_fee_tax_calculation', true, $fee_props ) ) { + return; + } + } + if ( $order = $item->get_order() ) { $item->delete_meta_data( '_split_taxes' ); $item->delete_meta_data( '_tax_shares' ); diff --git a/includes/wc-gzd-core-functions.php b/includes/wc-gzd-core-functions.php index 40a0aefce..f26ecb5d7 100644 --- a/includes/wc-gzd-core-functions.php +++ b/includes/wc-gzd-core-functions.php @@ -1304,7 +1304,7 @@ function wc_gzd_format_unit_price( $price, $unit, $unit_base, $product_units = ' } function wc_gzd_get_additional_costs_tax_calculation_mode() { - $value = get_option( 'woocommerce_gzd_tax_mode_additional_costs', 'split_tax' ); + $value = get_option( 'woocommerce_gzd_tax_mode_additional_costs', 'main_service' ); if ( ! in_array( $value, array( 'none', 'split_tax', 'main_service' ), true ) ) { $value = 'none'; diff --git a/tests/framework/helpers/class-wc-gzd-helper-order.php b/tests/framework/helpers/class-wc-gzd-helper-order.php index d40959bb2..9030dbe7f 100644 --- a/tests/framework/helpers/class-wc-gzd-helper-order.php +++ b/tests/framework/helpers/class-wc-gzd-helper-order.php @@ -69,7 +69,7 @@ public static function create_billing_order( $incl_tax = true, $items = array(), $item->set_props( array( 'method_title' => 'shipping', - 'total' => 8.403361, + 'total' => 10.0, // Germanized, by default, treats those as gross ) ); } else {