SaaS CMS has officially launched! Learn more now.

Mismatched shipping totals



We are using Commerce 12.17.2, we have a custom shipping gateway which implements IShippingPlugin. The expectation is that we compute custom shipping total using this implementation (which it does). But the issue arises when I see 2 different shipping totals; upon digging this further I see that the shipping total is calculated accuratley by the custom shipping gateway. But we also call the OrderGroup GetShippingSubTotal() method when displaying the shipping total which seems to be the culprit.

Our logic is to provide the shipping cost based on the order total percentage.


Order total: 84.50

Shipping cost percentage: 15%

So the shipping cost should be 15% of 84.50, which is 12.68 (After rounding 12.675).

The custom shipping gateway does give the right value of 12.68. But the GetShippingSubTotal() gives a value of 13.01, and this value is used to display the shipping cost on the checkout page of ours.

Below is a screen shot where you can see 2 different shipping calculations:

I also looked into the database to double check if the total in any of the the tables is different, which is causing this price difference. But all the tables have the correct order subtotal (84.5)

As a temporary fix I am overriding the CalculateShippingSubTotal from DefaultOrderGroupCalculator and I see it fixes the issue. But shouldnt the OrderGroup shipping total get updated in this scenario?

Edited, Mar 06, 2020 20:21

Hey Siddharth,

I can see in your screenshot there is only one OrderForm for this OrderGroup, so I'd be double-checking the implementation of your;

  1. IOrderFormCalculator to confirm its injected IShippingCalculator is using your custom shipping calculator. And have a close look at it's GetShippingSubTotal method.
  2. IOrderGroupCalculator to confirm its injected IOrderFormCalculator is using your IOrderFormCalculator (from above).

Here's the official doco on these;

Lastly, can you let us know if there are any currency or markets in play?

Edited, Mar 08, 2020 3:57
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.