Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ISSUE] Order amount does not match when applying discount from coupon codes to shipping costs #643

Closed
your-favorite-pm opened this issue May 23, 2023 · 2 comments
Labels
Investigating We are working on this issue together with the customer.

Comments

@your-favorite-pm
Copy link

Describe the bug
When a users adds a coupon code to cart, which also applies a discount to shipping costs, he gets thrown back to cart view with an exception:
[2023-05-12T10:17:22+0000] Error executing API call (422: Unprocessable Entity): The amount of the order does not match the total amount from the order lines. Expected order amount to be €250.86 but got €247.36. Field: amount. Documentation: Handling errors — API documentation — Mollie

Used versions

  • Magento 2.4.5.-p1:
  • Open source:
  • Mollie version number 2.25.0:

To Reproduce
Pre-conditions:
Active cart price rule with specificed coupon code which gives a discount (e.g. 10% discount) and applies also to shipping amount (= toggle: Apply to Shipping Amount = yes)
Steps to reproduce the behavior:

  1. As a user go to your store front, put any products to your cart
  2. Proceed to cart view / checkout
  3. Apply your coupon code
  4. Try to checkout and place your order

Expected behavior
Order is placed, user is on order success page

Actual behavior
Order is not placed, user is redirected back to cart, exception is thrown and displayed
[2023-05-12T10:17:22+0000] Error executing API call (422: Unprocessable Entity): The amount of the order does not match the total amount from the order lines. Expected order amount to be €250.86 but got €247.36. Field: amount. Documentation: Handling errors — API documentation — Mollie

Screenshots
Image 2023-05-23 at 2 21 14 PM

Additional context
Issue is related to improper applying discount from coupon code to shipping costs, when using Mollie payment.
Mollie module is not checking if any discount has been applied to shipping costs in Magento, so the calculations does not match each others:
\Mollie\Payment\Service\Order\Lines\Order::getShippingOrderLine

If the exact same cart price rule (Pre-conditions above) does not apply discount to shipping costs there is no exception and user can place its order (= toggle: Apply to Shipping Amount = no)

@Frank-Magmodules
Copy link
Collaborator

Hello there, @your-favorite-pm! It appears that I'm unable to replicate this problem in our test environments. Could you kindly reach out to us directly so that we can investigate it together? It's possible that there might be other plugins interfering with this calculation, as it seems to be functioning correctly on a default Magento setup. Thank you!

@Frank-Magmodules Frank-Magmodules added the Investigating We are working on this issue together with the customer. label May 23, 2023
@Frank-Magmodules Frank-Magmodules changed the title Order amount does not match when applying discount from coupon codes to shipping costs [ISSUE] Order amount does not match when applying discount from coupon codes to shipping costs May 26, 2023
michielgerritsen added a commit to michielgerritsen/mollie-magento2 that referenced this issue Jun 8, 2023
@Frank-Magmodules
Copy link
Collaborator

Hello there @your-favorite-pm! We've been in touch via email, but I wanted to confirm here as well that we've just released plugin version 2.27.0, which addresses the issue you reported. Thank you once again for reaching out to us directly and for your patience. I will close this issue for now since it has been resolved, but please feel free to reopen it if you encounter any further problems related to this matter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Investigating We are working on this issue together with the customer.
Projects
None yet
Development

No branches or pull requests

2 participants