You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I purchase a variably priced product with a percentage based discount, I expect the discount subtotal/total amounts to be correct in the adjustments database table.
Actual behavior
The discount is not calculated correctly and is either 0, or if a non-variable product is in the order, the discount is the amount for just the one item.
Steps to reproduce the behavior
Create a product with variable pricing.
Create a percentage based discount.
Add the variable product to your order and apply the discount.
Complete the order.
Note that the receipt appears to show the correct information and totals. However, if you check the edd_order_adjustments table for that order ID, the discount amount is incorrect. Additionally, when you go to edit the order in the admin, the discount does not show correctly, as it's calculated from the database, not the payment object (the receipt uses old payment functions 3.0 - update receipt shortcode template to use order object #8508).
Any other relevant information:
I'm not sure if the issue is in the edd_get_item_discount_amount function or in how the cart_details are built, but I think the failure point is here:
It looks like a similar issue was fixed in the cart for 2.10 in issue #8246, in which case we need to apply the same fix to the edd_get_item_discount_amount function.
Bug Report
Expected behavior
When I purchase a variably priced product with a percentage based discount, I expect the discount subtotal/total amounts to be correct in the adjustments database table.
Actual behavior
The discount is not calculated correctly and is either 0, or if a non-variable product is in the order, the discount is the amount for just the one item.
Steps to reproduce the behavior
edd_order_adjustments
table for that order ID, the discount amount is incorrect. Additionally, when you go to edit the order in the admin, the discount does not show correctly, as it's calculated from the database, not the payment object (the receipt uses old payment functions 3.0 - update receipt shortcode template to use order object #8508).Information (if a specific version is affected):
PHP Version: 7.4
EDD Version (or branch): release/3.0
WordPress Version: 5.7
Any other relevant information:
I'm not sure if the issue is in the
edd_get_item_discount_amount
function or in how thecart_details
are built, but I think the failure point is here:https://github.com/easydigitaldownloads/easy-digital-downloads/blob/af1e1439ff1eb60443bcd5cd8460f091bcaaaa0c/includes/discount-functions.php#L1028-L1030
It looks like a similar issue was fixed in the cart for 2.10 in issue #8246, in which case we need to apply the same fix to the
edd_get_item_discount_amount
function.This also affects an open PR in Invoices to show discounts.
Note: marking for beta2 as it's also affecting #8075.
The text was updated successfully, but these errors were encountered: