We have a multi-store with a bunch of products.

For certain categories in specific store views, I'd like to set all products to be in a particular store. Advice on how to achieve this would be greatly appreciated.

One of my biggest missing pieces is how to programmatically set the "Product in Stores" for each product -- I could probably figure out the rest from there. But yes, any thoughts would be appreciated.

  • have u got solutions? programmatically Commented Mar 9, 2020 at 8:59

2 Answers 2


You can easily assign products to different stores from adminpanel. Go to products grid catalog->products select all products or select selected products. Then click on actions dropdown from top left corner. Select Update Attribute then select websites. After that select specific store view's then save.

  • 1
    question was to add products programmatically. surprised to see this as an accepted answer. Commented Jan 15, 2021 at 10:44
  • That's fair @VishalParkash -- it solved my problem and I was grateful, so I probably got a little liberal with the green checkmark.
    – brackfost
    Commented May 21, 2021 at 15:48

For the sake of: If everyone every tries to google 'How to assign products to website or storeview programatically' Magento 1.9

Here's how, source from app/code/core/Mage/Adminhtml/controllers/Catalog/Product/Action/AttributeController.php


$actionModel = Mage::getSingleton('catalog/product_action');
$productIds  = $this->_getHelper()->getProductIds();

if ($websiteRemoveData) {
    $actionModel->updateWebsites($productIds, $websiteRemoveData, 'remove');
if ($websiteAddData) {
    $actionModel->updateWebsites($productIds, $websiteAddData, 'add');

Mage::dispatchEvent('catalog_product_to_website_change', array(
    'products' => $productIds

Where the $websiteAddData and $websiteRemoveData is defined as followed

$websiteRemoveData  = $this->getRequest()->getParam('remove_website_ids', array());
$websiteAddData     = $this->getRequest()->getParam('add_website_ids', array());

Meaning, you will need to specify an array of website ids.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.