Skip to content

Commit

Permalink
Fix tax calculation exempt while applying order voucher coupon.
Browse files Browse the repository at this point in the history
  • Loading branch information
dennisnissle committed Oct 25, 2024
1 parent f56c415 commit e1dae57
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 3 deletions.
2 changes: 0 additions & 2 deletions includes/class-wc-gzd-coupon-helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 );

Expand Down
2 changes: 1 addition & 1 deletion includes/class-wc-gzd-order-helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) ) {
Expand Down

0 comments on commit e1dae57

Please sign in to comment.