'Magento: Set a product to not be visible in search or catalog but the url still exist

I have a client request when a product is discontinued to make it so that product is not visible in catalog or search but the url and product still exists and you just can't order the product.

The only visibility options are catalog,search, catalog and search, not visible individually. If I just set the value to blank will it not be visible in catalog and search but still exist?

Is there a better way to do this?

UPDATE As Clockwork says below as long as you have it set in the configuration to not show out of stock products this is default functionality to keep the url and not show up in categories and search.



Solution 1:[1]

You can create a product with the visibility field set to Catalog, and don't assign it to any categories. This way no one will be able to find it while browsing the catalog and it won't be visible when a search is made, but you will still be able to access it via a link.

Solution 2:[2]

i know it's a long time but just for fun i publish a module for this purpose. it will add "product" to catalog product visibility enter image description here

https://github.com/gh-darvishani/product-visibility

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Adil Dar
Solution 2