Magento – Product not changing to ‘Out of stock’ even though qty has gone below minimum

addtocartbackordermagento-1out-of-stock

I have followed the steps of the very helpful solution on Add to cart for out of stock products

Now I can have products with the "Qty for Item's Status to Become Out of Stock" as “-1” instead of “0” whilst having “Stock Availability” as “In Stock”.

“-1” is my default config setting, but I have other products that have overidden this with a value of “0”.

This all seems great. I have run some successful test purchases and the “Qty” successfully changes to “-2” or “-1” in the Admin Panel as expected.

However, the problem I have is that “Stock Availability” does not change from “In Stock” to “Out of stock” when these “Qty for Item's Status to Become Out of Stock” thresholds are reached, meaning that the items continue to be orderable on the frontend. They should change to Out of stock. Please see screenshots.

screenshot1
screenshot2

I didn’t do step 7 of the referenced solution because I still want Magento to switch products to "Out of stock" on the backend and frontend, but perhaps I am confused here. Perhaps that code will somehow do what I want it to do but to be honest I am not sure how to apply it. I can see the code referred to in the list.phtml and view.phtml files, but an not sure what it is I am pasting. Do I paste all of it over part of the code, or just down to __('Out of stock') ?>
What is the significance of the space between __('Out of stock') ?> and __('In Stock')?>

Can anyone help please, sorry for my ignorance!

Best Answer

This happen because of you set Backorder=Allow Qty below 0
Change it with Backorder = No Backorder

or for all product

you must set is from admin >> system >> configuration >> catalog >> inventory

In product stock option

Backorders = No backorders

or

Qty for Item's Status to Become Out of Stock = 0

after that save it and refresh page.