Thursday, 23 June 2016

how to category load by category id Magento 2

$objectManager   = \Magento\Framework\App\ObjectManager::getInstance();

$category = $objectManager->create('Magento\Catalog\Model\Category')->load($_cat->getId());

3 comments:

  1. Can you help how we can update category using id ?

    ReplyDelete
  2. I am a magento user and here I got great information about magento platform. Now I am working on Magento SMS API to send SMS directly from Magento.

    ReplyDelete
  3. $objectManager = \Magento\Framework\App\ObjectManager::getInstance();

    $collection = $objectManager->create('Magento\Catalog\Api\CategoryRepositoryInterface');
    $store =$objectManager->create('Magento\Store\Model\StoreManagerInterface');

    $category = $collection->get($categoryId, $store->getStore()->getId());
    return $category->getData();

    ReplyDelete