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


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 – Jack Brooks Jan 3 '20 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); – Manish Chaubey Jan 3 '20 at 19:15
  • Let me know if my answer is helpful@Jack Brooks – Manish Chaubey Jan 3 '20 at 19:18
  • Hi @ManishChaubey I will get back to you soon as I tried this and thank you – Jack Brooks Jan 4 '20 at 13:37

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.