1

How to avoid out of Stock products to redirect visitors on the login page of magento

Update

On my Website the products are available even though they are out of stock and when a user clicks on them, it redirects them to the login page.

For Example: I am a user of this website. I want to buy a product : Sugar. When i click on "sugar" this redirects me directly at the admin panel login page of magento.

the configuration from the admin panel is :Admin >> System >> Configuration >> Catalog >> Inventory >> Stock Options Display Out of Stock product -> No

but still they are on website. How to give users a 404 error page in this case?

4
  • your question is not clear
    – Magento 2
    Oct 2, 2015 at 12:20
  • please provide more information on your issue. Oct 2, 2015 at 12:31
  • On WEbsite the products are available even thought they are out of stock and when user click on them, it redirects into login page. For Example. I am a user of this website. I want to buy a product : Sugar. i When i click on "sugar" this redirects me directly at the admin panel login page of magento. the configuration from the admin panel is :Admin >> System >> Configuration >> Catalog >> Inventory >> Stock Options Display Out of Stock product -> No .but still they are on website. How to give users a 404 error page in this case?
    – avelte
    Oct 2, 2015 at 12:37
  • If you enable this setting then magento are remove put of products from **frontend View ** .And if you want to see this product then it will redirect 404. It is magento feature
    – Amit Bera
    Oct 2, 2015 at 12:48

1 Answer 1

0

To prevent out of stock items (or any items for that matter) from displaying on the website at all, you must disable the individual product.

Failing to do so will still allow visitors to see the product page.

In order to force any item to redirect to a 404 page, do the following:

Magento -> Admin -> Catalog -> Products -> SET STATUS TO "DISABLED"

There are 3 primary best practice methods of doing this:

  1. Do it manually, as explained above

  2. Utilize the API or CSV import to set status to disabled when/if you update inventory from an external source (like your ERP)

  3. Do it programmatically, using a method similar to the one described here

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.