Skip to content

Incoherent total price in OrderTotalRuleChecker #13123

Closed
@mdevlamynck

Description

Sylius version affected: 1.8, 1.9, 1.0

Description
The rules OrderTotalGreaterThanOrEqualRuleChecker and OrderTotalGreaterThanOrEqualRuleChecker use the order total to check if a shipping method is available. Depending on when the rule is called, the total can be different for the same cart. For example:

  • When computing the list of shipping method for the checkout form the price is the complete total (products + shipping + taxes + promotions).
  • During the order processing steps, the price is the total without the adjustements (only products without taxes) since it runs just after OrderAdjustementsClearer.

It results in incoherent shipping method throughout the checkout.

Steps to reproduce

  1. Create one shipping method A available if total is bellow 100 with a price of 10.
  2. Create a second shipping method B available if total is above 100.
  3. Create a cart where items total is bellow 100 but above 91, default shipping method should therefore be A.
  4. On the shipping method selection form, only shipping method B is available (items total + estimated shipping cost of A > 100). Only A should be available in this form.

Possible Solution
User $order->getItemsTotal() instead of $order->getTotal().

I'm not sure if only products should contribute to the shipping method rule checker. Maybe taxes and promotion should contribute too. But at least shipping method cost should not contribute to shipping method rule checker.

Maybe also update the priority of the steps of order processors to recompute products price and taxes before selecting the shipping method as mentioned in #12554.

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions