diff --git a/includes/class-wc-gzd-coupon-helper.php b/includes/class-wc-gzd-coupon-helper.php index 5d2eeb5d..fc397970 100644 --- a/includes/class-wc-gzd-coupon-helper.php +++ b/includes/class-wc-gzd-coupon-helper.php @@ -357,8 +357,6 @@ public function add_voucher_to_order( $coupon, $order, $fee = false ) { $fee->update_meta_data( '_voucher_id', $coupon_data['id'] ); $fee->set_tax_status( 'none' ); - - // Add a placeholder negative amount to trigger the recalculation in WC_GZD_Discount_Helper::allow_order_fee_total_incl_tax() $fee->set_total( wc_format_decimal( $coupon_data['amount'] ) ); $fee->set_total_tax( 0 ); diff --git a/includes/class-wc-gzd-order-helper.php b/includes/class-wc-gzd-order-helper.php index c5c70af5..ea327f81 100644 --- a/includes/class-wc-gzd-order-helper.php +++ b/includes/class-wc-gzd-order-helper.php @@ -340,7 +340,7 @@ public function adjust_additional_costs_item_taxes( $item, $calculate_tax_for = $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->id = $item->get_meta( '_voucher_id' ) ? sanitize_title( $item->get_meta( '_voucher_id' ) ) : sanitize_title( $fee_props->name ); $fee_props->object = $fee_props; if ( ! apply_filters( 'woocommerce_gzd_force_fee_tax_calculation', true, $fee_props ) ) {