I'm looking for a solution on magento 2 to get per price or per cart totals the amounts per tax class or customer group.

The case is I have extended \Magento\Quote\Model\Quote\Address\Total\AbstractTotal to have an custom fee (percentage of grand_total - shipping) (based on how to add fee to order totals in magento2) in my cart. I also have a specific customer group with tax class (no tax rule, so 0% tax) for b2b customer, removing the tax from cart.

The tax is removed from cart overview when using b2b address, but the fee is still calculated over the total + tax. Then when switching to b2c address in payment page adds the tax again, but the fee calculation is done over the total without the tax.

At the moment of fee calculation the customer group id is correctly set. Any one with a solution or point me in the right direction ?

1 Answer 1


In Magento after a certain step quote is considered as a reference to proceed further.

So whenever your customer group gets switched make sure to recalculate quote.

Also check if your order totals logic is called again or not.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.