I need to remove some of my products from one a single website and it's store view. How do I do this, without ending up deleting it from all all stores?


The product-website association is kept in the table catalog_product_website.
If you have the product ids you can remove them fast from a specific website by running the query

    product_id IN (your product ids here separated by comma) AND
    website_id = website_id_here

When you are done, rebuild your indexes.

If you don't want to touch the database you can do it via code like this:

$productIds = array(...your product ids here...);
$websiteId = your website id here
Mage::getModel('catalog/product_website')->removeProducts(array($websiteId), $productIds);
  • I don't know exactly how the data profiles work (I've never used them) but I assume you don't get and id there because the id is not important for import /export functionality. but you should get an SKU. and from the SKU you can get the id like this $id = Mage::getModel('catalog/product')->getIdBySku($sku). – Marius Sep 15 '15 at 11:41
  • Thanks. Really appreciate it! :-) However, is this correct? removeProducts(array($websiteId), $productIds); Why would the websiteId be an array? – user2806026 Sep 15 '15 at 11:46
  • yes. It's correct. You can theoretically remove some products from more that 1 website at a time. And the method removeProducts expects the first parameter to be an array with 1 or more elements. if you need a confirmation take a look at Mage_Catalog_Model_Resource_Product_Website::removeProducts and see how it works. – Marius Sep 15 '15 at 11:48

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.