How to get product id from product which already added to cart in mini cart ?

I've opened this file :


but I still not have idea to get product id.


Get product id in minicart

$_item = $this->getItem();
$productId = $_item->getProduct()->getId(); 
| improve this answer | |
  • You know you can mark it accepted ;) – Dinesh Yadav Oct 13 '17 at 10:37
  1. You can get all product data with $product variable.

    <?php $_item = $this->getItem() ?>
            $product = Mage::getModel('catalog/product')
           echo "<pre>";
           echo "</pre>";           
| improve this answer | |
  • thank you, look like I will need it when I want get others data – mrfizh Oct 13 '17 at 10:37

You can get product data with $product variable using below code.

$_item = $this->getItem();
$product = $_item->getProduct(); 

And you can get product id using $product variable like below.

$productId = $product->getId();
| improve this answer | |

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.