“we can’t find products matching the selection” in magento 2.3 | Products are not visible on website frontend magento2.

There is a chances to get below error message on product list page after you have install or restore the database in magento setup.

Due to this error message, In website front-end products won’t be visible on product list page. This issue is might be one of following reason.

Solution :1
1. Reindex is not succeed
2. Installation (DB) was not installed properly (might be permission of the user role)
3. Cache issue.
4. Products attributes are not updated properly (Ex: Product might be out-of-stock, qty is 0,status is disabled, website not selected, Visibility not selected etc)
5. Category – Include in menu is not active (less chances)
6. Verify – Is Products are mapped with category with respecitive website.

Solution :2

With above steps (solution:1) the issue got not resolve then the possible issue is “inventory_stock_” table might be not present in your database table. Below tables also doesn’t have data due to inventory table missing form DB.

catalog_product_index_price
catalog_category_product_index or catalog_category_product_index_store1

How to identify the Issue:
Take any product ID which is active in-stock and other all configuration are done with properly. Go to browser and trigger following way

http://<baseURL>/catalog/product/view/id/<PRODUCT ID>

Error Message: Once after you trigger this URL, you may get below error message.

Base table or view not found: 1146 Table ‘inventory_stock_1’ doesn’t exist,
2 exception(s):
Exception #0 (Zend_Db_Statement_Exception): SQLSTATE[42S02]: Base table or view not found: 1146 Table ‘inventory_stock_1’ doesn’t exist, query was: SELECT `e`.*, `price_index`.`price`, `price_index`.`tax_class_id`, `price_index`.`final_price`,..

Reason: Issue with database backup. Create the backup or restore the backup there might be a chances of missing this table by Magento default system.

How to resolve: Run following Query to resolve the issue. This query will create the view with inventory_stock_ table.

Query without Mysql Username: 
DROP VIEW IF EXISTS inventory_stock_1;
CREATE ALGORITHM=UNDEFINED SQL SECURITY INVOKER VIEW `inventory_stock_1` AS select distinct `legacy_stock_status`.`product_id` AS `product_id`,`legacy_stock_status`.`website_id` AS `website_id`,`legacy_stock_status`.`stock_id` AS `stock_id`,`legacy_stock_status`.`qty` AS `quantity`,`legacy_stock_status`.`stock_status` AS `is_salable`,`product`.`sku` AS `sku` from (`<ENTER YOUR DATABASE NAME HERE>`.`cataloginventory_stock_status` `legacy_stock_status` join `<ENTER YOUR DATABASE NAME HERE>`.`catalog_product_entity` `product` on((`legacy_stock_status`.`product_id` = `product`.`entity_id`)));

Query with Mysql Username: 

CREATE ALGORITHM=UNDEFINED DEFINER=`<ENTER YOUR DATABASE USER NAME>`@`<ENTER YOUR HOST>` SQL SECURITY INVOKER VIEW `inventory_stock_1` AS select distinct `legacy_stock_status`.`product_id` AS `product_id`,`legacy_stock_status`.`website_id` AS `website_id`,`legacy_stock_status`.`stock_id` AS `stock_id`,`legacy_stock_status`.`qty` AS `quantity`,`legacy_stock_status`.`stock_status` AS `is_salable`,`product`.`sku` AS `sku` from (`<ENTER YOUR DATABASE NAME HERE>`.`cataloginventory_stock_status` `legacy_stock_status` join `<ENTER YOUR DATABASE NAME HERE>`.`catalog_product_entity` `product` on((`legacy_stock_status`.`product_id` = `product`.`entity_id`)));

Conserve Water !!! Conserve Life !!!