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

Shipping total includes all tax corrections from order #16487

Open
stefandoorn opened this issue Jun 28, 2024 · 0 comments
Open

Shipping total includes all tax corrections from order #16487

stefandoorn opened this issue Jun 28, 2024 · 0 comments
Assignees
Labels
RFC Discussions about potential changes or new features.

Comments

@stefandoorn
Copy link
Contributor

I'm having an use case where I need to add a tax correction on the order, related to an order_promotion that is added onto the order.

The correction is nicely deducted from the total VAT on the Cart Summary page. However, it's also deducated from the Shipping Total. Diving into that, leads me to this calculation in src/Sylius/Component/Core/Model/Order.php:

    /**
     * Returns shipping fee together with taxes decreased by shipping discount.
     */
    public function getShippingTotal(): int
    {
        $shippingTotal = $this->getAdjustmentsTotal(AdjustmentInterface::SHIPPING_ADJUSTMENT);
        $shippingTotal  = $this->getAdjustmentsTotal(AdjustmentInterface::ORDER_SHIPPING_PROMOTION_ADJUSTMENT);
        $shippingTotal  = $this->getAdjustmentsTotal(AdjustmentInterface::TAX_ADJUSTMENT);

        return $shippingTotal;
    }

This basically assumes that all tax adjustments on the order are related to shipping, which won't be the case always I assume.

The comment above the method kind of says that it should only be related to shipping discounts, but well, there can be other reasons for order discounts.

At least not in my situation, and the system is modular enough to cater for this kind of situations.

@mpysiak mpysiak added the RFC Discussions about potential changes or new features. label Jul 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RFC Discussions about potential changes or new features.
Projects
None yet
Development

No branches or pull requests

3 participants