I want to get the value of the is_active column through the method $this-> getQuoteCollection ($customerId) -> getLastItem (), I used getColumnValues('is_active'), but it doesn't return the last column (is_active) of the element

1 Answer 1


There are two options to get is_active quote. 1) Load checkout session and get active quote id and base on that id you can load quote.

protected $_checkoutSession;

public function __construct (
    \Magento\Checkout\Model\Session $_checkoutSession
    ) {
    $this->_checkoutSession = $_checkoutSession;

public function execute(\Magento\Framework\Event\Observer $observer)
  $cartData = $this->_checkoutSession->getQuote()->getAllVisibleItems();
  $cartDataCount = count( $cartData );

2) Load quote collection factory, use addfieldtofilter and get is_active quote.

use Magento\Quote\Model\ResourceModel\Quote\Item\CollectionFactory as   QuoteFactory;

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


Hope this will help you.

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.