-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Recalculate order adjustments total after adjustment is added or remo… #12502
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally, I think it's a good idea 👍 2 notes from me:
- we should probably add such a recalculation in every adjustable object (
Order
,OrderItem
andOrderItemUnit
) - I would start with changing the spec for the proper objects (e.g.
it_adds_adjustments_properly
for theOrder
) and call$this->getAdjustmentsTotal()->shouldReturn(XXX);
at the end
🖖
The base of this pull-request was changed, you need fetch and reset your local branch Unless you added new commits (to this branch) locally that you did not push yet, Feel free to ask for assistance when you get stuck 👍 |
OR 😄 in fact I'm not 100% sure should we merge it without adding the same feature on |
Bunnyshell Preview Environment deletedAvailable commands:
|
Thanks, @kayue! 🥇 |
In the current code (1.8 at least) adjustment total is not being updated after shipping fee is added to order. For example in the code below:
Sylius/src/Sylius/Component/Core/OrderProcessing/ShippingChargesProcessor.php
Lines 51 to 59 in f486b80
Recalculation is designed to happen when
$adjustment->setAmount()
is called, however the Order object is only added after. (in the last line)Proposed fixed is to trigger
recalculateAdjustmentsTotal()
whenever adjustment is added (or removed) to order.