I made a script that updates the stock status in database. I change them in the table named "cataloginventory_stock_status", but the changes doesn't appear on backend when I search for products by id. So I thought that it needs reindex. So I did that, but the problem is that after reindex the value of stock_status is changed back to what it was before.

I saw that is another table called "cataloginventory_stock_status_idx" so I tried to change the stock_staus here too (it seems like this tables are the same). But with no luck, the changes doesn't apply to the product on backend/frontend and after reindex my values put in the database are updated with the old ones.

I had to to this also for a custom attribute in the "catalog_product_flat_1" table. Same problem here.

Can you please help me with this? Do I have to change the stock_status of a product in another table, do I look at the wrong tables?

1 Answer 1


You should update cataloginventory_stock_item table too, and set the qty = 0. Depending on your system settings the stock status is calculated based on the stock items qty. That's why rebuilding your index will change your status. After updating cataloginventory_stock_item and cataloginventory_stock_status you need to rebuild the index.

  • It works now for stock status, but what about custom attribute in the catalog_product_flat_1 ? Commented Feb 4, 2019 at 15:41
  • what kind of custom attribute do you mean? If it is a product attribute you have added to magento that shouldn't have anything to do with stock status. For updating that kind of attributes you need to use the magento product import tool or update the corresponding eav table (i.e. catalog_product_entity_int, catalog_product_entity_varchar and so on). Then reindex (that will rebuild your catalog_product_flat_1 table)
    – HelgeB
    Commented Feb 4, 2019 at 15:56
  • yes, it was an attribute added by me for products, and it's working if i change it from catalog_product_entity_int , i just needed to look at the url on backend and see it's id (the attrbute id) and find the product id in the table. It's working now and after reindex the catalog_product_flat_1 is updated too. Commented Feb 5, 2019 at 8:18

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.