Is there anyway I could print out in a table in phtml the following: Entity_id , is_active and store Is it possible to get all active quote within a customer_id?

I want to show this in a table I was taking a look at quote DB and I can see all the details there but not sure how to show this in a phtml

1 Answer 1


To get quote items of a customer please use below code. You can pass customer object also in place of customer id.

protected $quoteModel;

public function __construct(
    \Magento\Quote\Model\QuoteFactory $quoteFactory,
    \Magento\Quote\Model\ResourceModel\Quote $quoteModel
) {
    $this->quoteFactory = $quoteFactory;


$quote = $this->quoteFactory->create();
$customerQuote=$this->quoteModel->loadByCustomerId($quote,$customerId); // where `$customerId` is your `customer id`

Hope it will help Thanks

  • Would I be able to get is_active? I haven’t used this Commented Jan 3, 2020 at 19:00
  • Yes you can get is_active for that you have to use quote item collection. use Magento\Quote\Model\ResourceModel\Quote\Item\CollectionFactory as QuoteFactory; public function __construct( QuoteFactory $quoteFactory ) { $this->quoteFactory = $quoteFactory; } $this->quoteFactory->create()->addFieldToFilter('quote_id',$quoteId)->addFieldToFilter('is_active',1); Commented Jan 3, 2020 at 19:15
  • Let me know if my answer is helpful@Jack Brooks Commented Jan 3, 2020 at 19:18
  • Hi @ManishChaubey I will get back to you soon as I tried this and thank you Commented Jan 4, 2020 at 13:37

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.