Hi!
One of my users for my Moneybird plugin filed an issue that tax rules for negative fees (i.e. discounts) weren’t applied properly.
Upon further inspection I noticed that the no_tax
property for fees isn’t stored/fetched properly when the EDD_Payment is created, e.g. when using edd_get_payment()
.
In includes/payments/class-edd-payments.php
on line 2850, there’s this code:
So, while creating the EDD_Payment object, the no_tax
property is based upon the fact whether the current fees tax is 0.
While in includes/class-edd-fees.php
on line 115 in the edd_add_fee()
function (which is used when storing it to the session) the no_tax
property is based upon the fact whether the fee is negative or not:
So, for negative fees, this creates an inconsistency between what’s stored in the session and what’s present in the fees
property of the EDD_Payment
.
IMO, line 2850 in includes/payments/class-edd-payments.php
should be changed to (bool) $args['amount'] < 0
to fix this. But, that’s just an assumption.
Looking forward to a fix!