How to customize the page "No products were found matching your selection" in WooCommerce - Online Store Sales Optimization

In this article we will see how to customize the page "No products were found matching your selection”What appears when a search in a shop cu WooCommerce, no results are returned. Specifically, a short guide to WooCommerce Best Practices for optimizing sales and a better experience for potential buyers.

Most topics WordPress optimized for WooCommerce, does not offer administratorstore owners the possibility to customize the page in which no results are displayed following a search on the online store. “No products were found matching your selection"Or"No Products Found".

No products were found matching your selection
No products were found matching your selection

In such a page where no results are displayed, the potential buyer has no choice but to return to the navigation menu of the site and see are other products that would be interested.
A better optimization for sales would be to provide the user with information about promotions, quick contact information or other products / product categories on this page.

How to customize the page "No products were found matching your selectionFrom WooCommerce

The PHP file that responds to the page with zero results when searching for a product in an online store with WooCommerce, is no-producs-found.phpLocated in wp-content/plugins/woocommerce/templates/loop and contains the code:

<?php
defined( 'ABSPATH' ) || exit;
?>
<p class="woocommerce-info"><?php esc_html_e( 'No products were found matching your selection.', 'woocommerce' ); ?></p>

As you can see, in this file is the text that appears on the "No Products Found" page. This text differs from language to language if the online store is set to a language supported by WooCommerce.

If we want to change the content of the page "No Products Found", The best method is to make a clone of this file in the active theme folder: /themes/active_theme/woocommerce/templates/loop/no-producs-found.php. Thus a update WooCommerce will not remove our changes.

After this step, we can proceed as we wish to edit the file no-products-found.php.
It is preferable to use shortcodes, especially if the theme allows "UX Blocks", such as Flatsome, or "HTML Blocks" as in the case of WoodMart and other WooCommerce themes.

My favorite method was to replace the code:

<p class="woocommerce-info"><?php esc_html_e( 'No products were found matching your selection.', 'woocommerce' ); ?></p>

with a shortcode to an HTML block in which to add banners, products, product categories. Thus, if this page is reached, the potential buyer will be attracted to the products and promotions from the online store.

<?php echo do_shortcode('[block id="search"]'); ?>

Where [block id="search"] represents a shortcode on a custom HTML page.

In the following I will publish some more WooCommerce - Best Practice stuff, which I have successfully applied to several online stores.

How to » WordPress » How to customize the page "No products were found matching your selection" in WooCommerce - Online Store Sales Optimization

Passionate about technology, I like to test and write tutorials about operating systems macOS, Linux, Windows, about WordPress, WooCommerce and configure LEMP web servers (Linux, NGINX, MySQL and PHP). I write on StealthSettings.com since 2006, and a few years later I started writing on iHowTo.Tips tutorials and news about devices in the ecosystem Apple: iPhone, iPad, Apple Watch, HomePod, iMac, MacBook, AirPods and accessories.

1 thought on "How to customize the page "No products were found matching your selection" in WooCommerce - Optimizing Sales on Online Stores"

Leave a Comment