Hot answers tagged

3

I think this code will help you!! $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $cart = $objectManager->get('\Magento\Checkout\Model\Cart'); // get quote items collection $itemsCollection = $cart->getQuote()->getItemsCollection(); // get array of all items what can be display directly ...


2

You can't with cache enabled, all files aren't re-interpreted. You should get it with customer data. You can try to add the following code in your phtml file. <script type="text/javascript"> require([ 'Magento_Customer/js/customer-data' ], function (customerData) { 'use strict'; customerData.get('cart').subscribe(...


1

To get quote items of a customer please use below code. You can pass customer object also in place of customer id. <?php protected $quoteModel; public function __construct( ... \Magento\Quote\Model\QuoteFactory $quoteFactory, \Magento\Quote\Model\ResourceModel\Quote $quoteModel .... ) { .... $this->quoteFactory = $...


Only top voted, non community-wiki answers of a minimum length are eligible