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?".

1

2 Answers 2

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.

0

You can use

\Magento\Quote\Api\CartRepositoryInterface

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

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.