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
[Shipment] Applying discounts and taxes for each shipment #12282
[Shipment] Applying discounts and taxes for each shipment #12282
Conversation
GSadee
commented
Jan 27, 2021
Q | A |
---|---|
Branch? | master |
Bug fix? | no |
New feature? | no |
BC breaks? | I guess there is no |
Deprecations? | no |
Related tickets | |
License | MIT |
And the order's tax total should be "$24.15" | ||
And the order's total should be "$129.15" | ||
|
||
@ui @domain |
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.
I wonder if this scenario should have @ui
tag, because multiple shipments in Sylius could be used in background and displayed in admin panel, but there is no possibility to create more than one shipment during our checkout for now.
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.
Domain test is really nice, but I would leave it with UI test as well. One cannot create multiple shipments in pure Sylius, but it does not take much to change it.
f8489f1
to
6e1db83
Compare
$taxRate = $this->taxRateResolver->resolve($shippingMethod, ['zone' => $zone]); | ||
if (null === $taxRate) { | ||
return; | ||
if (!$order->hasShipments()) { |
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.
I'm not sure it is 100%. I'm wondering if we can have shippingTotal > 0 with no shipments? Maybe we can make an early return for lack of shipment and then check the total value of it?
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.
Or at least we should change the error message, as the order may not have any shipment at all.
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.
To be honest, I tried to keep the previous behaviour as much as possible, this check and error throw was moved here from the private method that was below: https://github.com/Sylius/Sylius/blob/master/src/Sylius/Component/Core/Taxation/Applicator/OrderShipmentTaxesApplicator.php#L96:L105
a370552
to
31053ce
Compare
201a3ae
to
881054e
Compare
881054e
to
1e64629
Compare
Thank you, Grzegorz! 🥇 |