I want to change the default functionality of search in visibility. When product Visibility is set to Search or Not Visible Individually it should not appear in the search dropdown, search results, or category pages.

Does anyone know the path to change it?

  • Before asking a new question, you should accept the answer to your previous questions.
    – Keyur Shah
    May 10, 2019 at 13:24
  • @KeyurShah I already have May 13, 2019 at 11:35

3 Answers 3


For Product Listing Page Copy This File in Your Theme


For Search Result Copy This File in Your Theme


In This File You Can Apply Filter On Collection.

$collection->addAttributeToFilter('visibility', \Magento\Catalog\Model\Product\Visibility::VISIBILITY_IN_CATALOG); 

You can change this in backend:

  1. click edit product and change Visibility attribute.


  2. select few products and select change attributes => change visibility.

enter image description here

  • I want search functionality to behave like not visible individually May 10, 2019 at 9:39
  • You have option Not Visible Individually
    – BartZalas
    May 10, 2019 at 9:44
  • yes, but the client wants the search to work like not visible individually May 10, 2019 at 9:45
  • Do you want to hide search bar or products? If You check in product "Not visible Individually" this will hide this product.
    – BartZalas
    May 10, 2019 at 10:02

You need to Extension setVisibility method of below class:


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.