0

In magento 1 my code is,

 Mage::getSingleton('adminhtml/session_quote');

How can I change this piece of code in magento 2?

I know I would need to do something like this:

However, what would be ('adminhtml/session_quote') in magento 2?

Please can anyone help?

1

You can use in Magento 2 similar to Magento 1 by below way,

Magento\Backend\Model\Session\Quote

use in class like below way,

public function __construct(
    \Magento\Backend\Model\Session\Quote $sessionQuote
) {
    $this->sessionQuote = $sessionQuote;
}

Use like below way after use above,

$this->sessionQuote->getOrder();
$this->sessionQuote->getQuote();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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