diff --git a/Model/Autocomplete/DataProviderHelper.php b/Model/Autocomplete/DataProviderHelper.php index 6bc2ff99..a42a0dca 100644 --- a/Model/Autocomplete/DataProviderHelper.php +++ b/Model/Autocomplete/DataProviderHelper.php @@ -12,6 +12,7 @@ use Magento\Catalog\Api\CategoryRepositoryInterface; use Magento\Catalog\Model\Category; use Magento\Catalog\Model\Layer\Category\CollectionFilter; +use Magento\Catalog\Model\Product\Visibility; use Magento\Catalog\Model\ResourceModel\Product\CollectionFactory as ProductCollectionFactory; use Magento\Framework\App\Request\Http as HttpRequest; use Magento\Framework\Exception\LocalizedException; @@ -134,6 +135,10 @@ public function getProductItems(AutocompleteProductResponseInterface $response) $productCollection = $this->productCollectionFactory->create(); $productCollection->setStore($this->storeManager->getStore()); $productCollection->addAttributeToFilter('entity_id', ['in' => $response->getProductIds()]); + $productCollection->addFieldToFilter('visibility', ['in' => [ + Visibility::VISIBILITY_BOTH, + Visibility::VISIBILITY_IN_SEARCH + ]]); $this->collectionFilter->filter($productCollection, $this->getCategory()); $result = [];