Try our conversational search powered by Generative AI!

Best practice regarding handling of costs connected to selected payment method?



I've been trying to find a good solution for this online but without success so would like to get your insight into a "best way" of solving this task. 

The task is that when a customer chooses to pay their order using invoice a certain handling cost for this needs to be added to the order. For shipping options this is built into the commerce platform but I can't find a similar solution for payment options. How would you go about solving this issue in the best (and easiest ;-)) way?

Options I can think of are:

 - Adding a lineitem to the cart, so pretty much handle the payment handling cost as a product

 - Adding a meta field to the cart where information about payment handling cost is stored, which then needs to be taken into account on different places in the solution

Any suggestions about how to handle this, or is there any hidden gems in the platform that I don't know of?

Best regards


Oct 31, 2016 8:24

Hello Martin

If it is the only handling cost you have i would recommend that you use the HandlingTotal field on OrderForm and take it into account in your calculations.

By using this field it will be automatically displayed together with the other sums in commerce when looking on orders.

Kind Regards


Oct 31, 2016 9:57

Hello Erik, 

Sounds like a solution that could work. However, when setting HandlingCost on the cart, accept the changes on the cart and then execute the CartValidateWorkflow, after that the handlingcost is still 0. I've also tried to reproduce this in Quicksilver (version 9.24.1 of Commerce) by setting HandlingCost on the cart when adding a product to the cart but the same thing happens there. Have you successfully implemented this in a solution and if so, what am I doing wrong?

Best regards


Nov 01, 2016 8:10

We have done it in several solutions but we normally don't use the workflows.

I have to ask thou, did you set the HandlingTotal on the OrderForm as i suggested or directly on the Cart/OrderGroup?

The default implementation of CartValidateWorkflow uses the CalculateTotalsActivity which sets the HandlingTotal of the Cart/OrderGroup to the sum of the HandlingTotals on it's OrderForms.


Edited, Nov 01, 2016 10:42

You were right, I tried adding it to the cart directly, adding it to the OrderForm works better. However, the Total cost for the cart does not seem to include the HandlingCost after adding it correctly to the OrderForm. It includes the total cost of the articles in the cart and the cost for shipping, if any, but not the handling cost. Is this something that you've come across as well?


Nov 10, 2016 21:33

Yes that is the standard way episerver calculates totals unfortunatly.

Using the new order api's you can register your own implementations of IOrderFormCalculator and IOrderGroupCalculator to change it, inherit from the default implementations if you don't want to written it all again.


Nov 11, 2016 13:57

Ok, yes that's a bit unfortunate. I actually sent this question to episerver support also and they created a bug report for it, let's wait and see if that results in a change in the platform or not. 

Thanks for your help!


Nov 11, 2016 14:05

Yes i suspect it is a legacy from the old commerce solution which was from america, where they don't really allow charging for payment options if i recall correctly.


Nov 11, 2016 14:08

FYI, the issue of HandlingTotal not being included in the Total cost for a order form has been solved in a recent release: 


Dec 20, 2016 17:13
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.