Skip to main content
1 of 2
Ketan Borada
  • 2.7k
  • 2
  • 37
  • 78
<?php 

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$item = $objectManager->create('Magento\Catalog\Model\Product');
$quoteId = $objectManager-> create('Magento\Checkout\Model\Session')->getQuoteId();
$cartData = $objectManager->create('Magento\Quote\Model\QuoteRepository')->get($quoteId)->getAllVisibleItems(); 

foreach($items as $item) {
    //$item = $item->load($item->getProductId()); load product

    if($item->getSku()=='SM100'){
        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 />";   
    }


  }
Ketan Borada
  • 2.7k
  • 2
  • 37
  • 78