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 var_dump the output of $toRefundItem->get_quantity(), the output is string(5) "-100." . I don't know if this is expected when you enter "100" as refund quantity. I certainly did not type a dot after the value.
When I check the output of $toRefundItem, I get this result:
So for some reason. The quantity refund breaks on this.
The workaround that fixed the problem for me was to add (int) inside the abs() function. So change this: $toRefundItemQuantity = abs($toRefundItem->get_quantity());
To this: $toRefundItemQuantity = abs((int) $toRefundItem->get_quantity());
I can now perform refunds in WooCommerce again.
Plugin version:
7.9.17.9.1
The text was updated successfully, but these errors were encountered:
When trying to do a refund on some orders. It's not working and give a fatal error:
The problem seems to lie within this line:
WooCommerce/src/Payment/RefundLineItemsBuilder.php
Line 108 in c2981ac
$toRefundItemQuantity = abs($toRefundItem->get_quantity());
When I var_dump the output of $toRefundItem->get_quantity(), the output is
string(5) "-100."
. I don't know if this is expected when you enter "100" as refund quantity. I certainly did not type a dot after the value.When I check the output of $toRefundItem, I get this result:
So for some reason. The quantity refund breaks on this.
The workaround that fixed the problem for me was to add (int) inside the abs() function. So change this:
$toRefundItemQuantity = abs($toRefundItem->get_quantity());
To this:
$toRefundItemQuantity = abs((int) $toRefundItem->get_quantity());
I can now perform refunds in WooCommerce again.
Plugin version:
7.9.17.9.1
The text was updated successfully, but these errors were encountered: