cancel
Showing results for 
Search instead for 
Did you mean: 

Changing calculation of totals in shopping cart

Changing calculation of totals in shopping cart

Hi guys,

 

I'm looking for this a couple of days, but no luck yet. We're trying to call a Rest service which calculates the subtotal/discount/total in the shopping cart, based on the items in the cart. Our Rest needs the product numbers to calculate the totals.

 

I saw something in Magento 1.x about a TotalCollector, but can't find the right classes/config in Magento 2. And I'm not sure if that's the right direction.

 

Can anybody provide some help please?!

 

Thanks.

1 REPLY 1

Re: Changing calculation of totals in shopping cart

I'm trying it differently now, by defining a new implementation of Quote.php and overriding getTotals() and collectTotals(). Not sure if that's the right way though..

 

How can Quote.php be overwritten with the one from my extension? Without changing Magento code... For now I changed the QuoteRepository to use my class factory instead of QuoteFactory.