Log in
Model

TotalsCollector

Magento\QuoteGraphQl\Model\Cart\TotalsCollector

What it does

This class acts as a caching wrapper around Magento's quote totals calculation to prevent redundant, expensive total calculations during GraphQL requests.

Developers would use this when building GraphQL resolvers that need cart totals, as it stores previously calculated totals per quote/address and returns cached values unless explicitly told to recalculate, significantly improving performance for multiple total requests in the same request lifecycle.

Public Methods

  • _resetState()
  • clearTotals()
  • collectQuoteTotals()
  • collectAddressTotals()