When I try to update a category category name programmatically only for StoreView 2, it does not work.

The changes will go to StoreView 1 every time and not to the StoreView that I defined:

    use \Magento\Framework\App\Bootstrap;


    $bootstrap = Bootstrap::create(BP, $_SERVER);
    $objectManager = $bootstrap->getObjectManager(); 
    $category = $objectManager->get('\Magento\Catalog\Model\Category')->load(78);

    $d["updated_at"] = "2016-10-14 10:22:34";
    $d["entity_id"] = "78";
    $d["psl_wawi_cat_id"] = "42";
    $d["position"] = "10";
    $d["is_active"] = "1";
    $d["store_id"] = "2";
    $d["store"] = "2";
    $d["storeid"] = "2";
    $d["is_anchor"] = "1";
    $d["name"] = "TESTA-1_ENG";
    $d["custom_design_from"] = "";
    $d["custom_design_to"] = "";
    $d["include_in_menu"] = "1";
    $d["default_sort_by"] = "";
    $d["path"] = "1/2/74/78";
    $d["level"] = "3";
    $d["url_key"] = "testa-1-eng";
    $d["attribute_set_id"] = "3";


After running this script the name of the category is "TESTA-1_ENG" in StoreView 1 but not in StoreView 2. StoreView 2 still has the original name from the create process.

I think this may be a bug? Every save process will only affect StoreView 1 and not to the StoreView that I defined.

bumped to the homepage by Community 7 hours ago

This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.


You must load category with specific store id, If you need to change details of specific store.

Please use below code to modify category details for specific store.

$category = $objectManager->create('Magento\Catalog\Model\CategoryFactory')->create()->setStoreId(2)->load(78);
  • no its not working, category name is not updating – jafar pinjar Sep 10 '18 at 12:44
  • It is working fine for me. – Bhavin iFlair Sep 12 '18 at 12:03

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.