Edit "No Products were found" message

This topic has 7 replies, 2 voices, and was last updated 6 years, 5 months ago ago by Rose Tyler

  • Avatar: jodybethw
    jodybethw
    Participant
    June 1, 2018 at 22:08

    I’d like to change the message that appears when a shop page is accessed that does not currently have any products on it. For example, I see this on one of my pages:

    NO PRODUCTS WERE FOUND
    We invite you to get acquainted with an assortment of our shop. Surely you can find something for yourself!

    [Button to return to the main shop page]

    Where can I make this change? I can’t seem to find it.

    6 Answers
    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    June 4, 2018 at 07:43

    Hello,

    You can change this text via translation https://www.8theme.com/documentation/xstore/theme-translation/base-theme-translation/ for example – http://prntscr.com/jqirqb or rewrite no-products-found.php file (xstore/woocommerce/loop) via the child theme https://codex.wordpress.org/Child_Themes

    Regards

    Avatar: jodybethw
    jodybethw
    Participant
    June 5, 2018 at 22:10

    I do not have this php file. Can I download it somewhere? I only see loop-end.php, loop-start.php and pagination.php in that folder.

    Avatar: jodybethw
    jodybethw
    Participant
    June 5, 2018 at 22:14

    I found the file and edited it, but it didn’t change anything. The text isn’t the same as what I see on the page. The code of the file:

    <?php
    /**
     * Displayed when no products are found matching the current query
     *
     * This template can be overridden by copying it to yourtheme/woocommerce/loop/no-products-found.php.
     *
     * HOWEVER, on occasion WooCommerce will need to update template files and you
     * (the theme developer) will need to copy the new files to your theme to
     * maintain compatibility. We try to do this as little as possible, but it does
     * happen. When this occurs the version of the template file will be bumped and
     * the readme will list any important changes.
     *
     * @see 	    https://docs.woocommerce.com/document/template-structure/
     * @author 		WooThemes
     * @package 	WooCommerce/Templates
     * @version     2.0.0
     */
    
    if ( ! defined( 'ABSPATH' ) ) {
    	exit; // Exit if accessed directly
    }
    
    ?>
    <p class="woocommerce-info"><?php _e( 'TEST No products were found matching your selection.', 'woocommerce' ); ?></p>
    
    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    June 6, 2018 at 07:23

    Hello,

    Please see screenshots – http://prntscr.com/jrg8zc > http://prntscr.com/jrg98p

    <?php
    /**
     * Displayed when no products are found matching the current query.
     *
     * Override this template by copying it to yourtheme/woocommerce/loop/no-products-found.php
     *
     * @author 		WooThemes
     * @package 	WooCommerce/Templates
     * @version     2.0.0
     */
    
    if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
    ?>
    
    <div class="empty-category-block">
    	<h2><?php esc_html_e('test No products were found', 'xstore'); ?></h2>
    	<p class="not-found-info"><?php esc_html_e('We invite you to get acquainted with an assortment of our shop. Surely you can find something for yourself!', 'xstore') ?></p>
    	<p><a class="btn medium" href="<?php echo get_permalink(wc_get_page_id('shop')); ?>"><span><?php esc_html_e('Return To Shop', 'xstore') ?></span></a></p>
    </div>

    Regards

    Avatar: jodybethw
    jodybethw
    Participant
    June 6, 2018 at 17:39

    I placed your code at x-child/woocommerce/loop/no-products-found.php but it isn’t working. And yes, I have verified that the child theme is active.

    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    June 6, 2018 at 18:51

    Hello,

    Please provide us with temporary wp-admin and FTP access in the Private Content area so we can take a closer look.

    Regards

  • Viewing 7 results - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.Log in/Sign up

8theme customization service
We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.