Open dalguji opened 2 years ago
Which payment gateway are you using?
I am using this one: https://wordpress.org/plugins/iamport-for-easy-digital-downloads/
That might be an issue you need to report to that developer. Right now we handle this logic inside the gateway, and all our own internal gateways process $0 payments via manual. So unless it can be reproduced via a built-in gateway, you'll have to report the bug to the gateway developer.
My understanding is that if a product costs $10 and discount is 100%, the subtotal price will be $10 and the total price will be $0. $0 payments in total should be processed by manual gateway.
However the code below is missing to check the total price, it only checks subtotal price when choosing the gateway in function edd_get_chosen_gateway()
:
That's why I opened this issue. If I am misunderstanding something, could you please shed more light on this?
Bug Report
Expected behavior
When I put a product in EDD cart and apply a 100% discount coupon to it so the total price becomes 0, I expect it goes to 'manual' gateway.
Actual behavior
It goes to a credit card gateway and the purchase gets denied by the PG because the payment amount is 0.
Steps to reproduce the behavior
1) Create a 100% discount coupon. 2) Put any product in EDD cart 3) Apply a 100% discount coupon to the product. 4) Click 'Purchase' button
Information (if a specific version is affected):
PHP Version: 7.3
EDD Version (or branch): 2.10.1
WordPress Version: 5.7
Any other relevant information: I suggest to change
edd_get_cart_subtotal()
toedd_get_cart_total()
on the line below: https://github.com/easydigitaldownloads/easy-digital-downloads/blob/5657a2b4355874b30a2a08d0b79162a739f609ef/includes/gateways/functions.php#L374