Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $objectManager = MagentoFrameworkAppObjectManager::getInstance();
- $cart = $objectManager->get('MagentoCheckoutModelCart');
- // get quote items collection
- $itemsCollection = $cart->getQuote()->getItemsCollection();
- // get array of all items what can be display directly
- $itemsVisible = $cart->getQuote()->getAllVisibleItems();
- // get quote items array
- $items = $cart->getQuote()->getAllItems();
- $itemsVisible = $cart->getQuote()->getAllItems();
- // get quote items array
- $items = $cart->getQuote()->getAllVisibleItems();
- foreach($itemsCollection as $item) {
- echo 'ID: '.$item->getProductId().'<br />';
- echo 'Name: '.$item->getName().'<br />';
- echo 'Sku: '.$item->getSku().'<br />';
- echo 'Quantity: '.$item->getQty().'<br />';
- echo 'Price: '.$item->getPrice().'<br />';
- echo "<br />";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement