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".
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
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:
/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
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"]'); ?>
[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.
1 thought on "How to customize the page "No products were found matching your selection" in WooCommerce - Optimizing Sales on Online Stores"