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
Rounding differences can change the basket to contain physical goods and lead to additional errors such as order failure.
To Reproduce
Create an order with only digital goods which introduces rounding differences (I guess because PayPal is receiving net values; here, this happens with a VAT of 19% and two items of 9.50 gross value each).
An extra_line item Subtotal mismatch will be added by default by PurchaseUnitSanitizer. This item is a physical product.
An error can occur at a later point, which would otherwise not happen, such as in OrderProcessor::process:
if ($this->order_helper->contains_physical_goods($order) && !$this->order_is_ready_for_process($order)) {
throw new Exception(__('The payment is not ready for processing yet.', 'woocommerce-paypal-payments'));
}
This is because $this->order_helper->contains_physical_goods($order) now returns true.
Expected Behavior
I expect the order to go through.
Actual Behavior
An exception is sometimes (always?) thrown after the order is completed and the order fails (even though it has already been paid) at the mentioned lines in OrderProcessor::process.
Environment
WordPress Version 6.8.1
WooCommerce Version 9.8.4
Plugin Version 3.0.5
Additional Details
My workaround is to patch PurchaseUnitSanitizer::sanitize_item_amount_mismatch:
$this->purchase_unit['items'][] = (new Item($line_name, $roundings_money, 1, category: Item::DIGITAL_GOODS))->to_array();
Problems with that implementation: This will always add digital goods and is only PHP 8.0+ (not 7.4).
The text was updated successfully, but these errors were encountered:
luzat
added a commit
to luzat/woocommerce-paypal-payments
that referenced
this issue
May 9, 2025
Rounding differences were previously added as physical goods, which changed the properties of the
cart. Now, if the cart does not contain physical items, the extra line item will be added as a
digital goods item.
Uh oh!
There was an error while loading. Please reload this page.
Describe the Bug
Rounding differences can change the basket to contain physical goods and lead to additional errors such as order failure.
To Reproduce
Subtotal mismatch
will be added by default byPurchaseUnitSanitizer
. This item is a physical product.OrderProcessor::process
:This is because
$this->order_helper->contains_physical_goods($order)
now returnstrue
.Expected Behavior
I expect the order to go through.
Actual Behavior
An exception is sometimes (always?) thrown after the order is completed and the order fails (even though it has already been paid) at the mentioned lines in
OrderProcessor::process
.Environment
Additional Details
My workaround is to patch
PurchaseUnitSanitizer::sanitize_item_amount_mismatch
:Problems with that implementation: This will always add digital goods and is only PHP 8.0+ (not 7.4).
The text was updated successfully, but these errors were encountered: