gary
11/30/2018 - 1:27 PM

Magento - Get the Current product & its categories

Magento - Get the Current product & its categories

Magento - Get the Current product & its categories

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$product = $objectManager->get('Magento\Framework\Registry')->registry('current_product');//get current product
$cats = $product->getCategoryIds();