1

Magento 2 i want qoute id in order crete page admin, but i got null in quote id.
I'm Using Magento\Checkout\Model\Session

$this->checkoutSession->getQuote()->getId();

1 Answer 1

1

For the admin quote session you need to use

  • \Magento\Backend\Model\Session\Quote

See

  public function __construct(
    ....
    \Magento\Backend\Model\Session\Quote $quoteSession,
   
  ) {

      $this->_session = $quoteSession;
  }

  public function getSession()
  {
      return $this->_session;
  }

  /**
   * Retrieve quote object model
   *
   * @return \Magento\Quote\Model\Quote
   */
  public function getQuote()
  {
      if (!$this->_quote) {
          $this->_quote = $this->getSession()->getQuote();
      }

      return $this->_quote;
  }

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.