Magento 2

How To Load Quote Data By Id In Magento 2.4

Magento 2

How To Load Quote Data By Id In Magento 2.4

You can fetch the quote object by quote id in Magento 2.

Load quote by id using QuoteFactory of Quote Module. If you are working for fronted functionality and if you need to load quote data, in this case, you have helped this article.

Using Constructor :

<?php
use Magento\Quote\Model\QuoteFactory;

protected $quoteFactory;


public function __construct(QuoteFactory $quoteFactory) 
{
    $this->quoteFactory = $quoteFactory;
}

public function getQuote($quoteId)
{
    return $this->quoteFactory->create()->load($quoteId);
}

Using ObjectManager :

<?php

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$orderQuoteFactory = $objectManager->create('Magento\Quote\Model\QuoteFactory');

$quote = $orderQuoteFactory->create()->load($quoteId);

dd($quote);

That’s it.