2

The Magento\Checkout\Model\Cart class was marked as deprecated a long time ago (since 2.1 ver.). What should I use instead of it to work with a customers cart?

I know that I can work directly with a Quote model, but maybe exists some interface which replaced the Cart model functional?

PS: I read the answer given here about "Why it is deprecated?", but I need the information about "What should I use instead?".

Siarhey Uchukhlebau
  • 15,957
  • 11
  • 54
  • 83

2 Answers2

3

As far as I know, there is no replacement as of now (Magento 2.2), the class was simply deprecated as an indication that the logic it handles will be refactored in the future. Just continue to use it for now until a proper replacement is implemented.

TiEul
  • 1,297
  • 10
  • 19
0

You can use

\Magento\Quote\Api\CartRepositoryInterface

For more information, you can see this post : Resolve cart deprecated