Edit no products found message on a specific tag page only
-
Hi team,
I want to edit the “no products found” message on a specific tag page only for guests, in this case ‘pulseras’. i.e. if the guest types a wrong reference on the search bar at the shop page, the default “no products found” mesage should show up.
I found that the hook below is actually working as expected BUT rather than the tag page, it works in the shop page:
shop page// Customise the message when no products found. add_action('wp_head', 'change_no_products_found_text'); function change_no_products_found_text() { if (is_product_tag && !is_user_logged_in()) { // Remove the original code that uses the no-products-found.php template. remove_action('woocommerce_no_products_found', 'wc_no_products_found'); // and add in my own code. add_action('woocommerce_no_products_found', 'no_products_found_new'); } } function no_products_found_new() { ?> <div class="row products-loop products-grid with-ajax row-count-4" data-row-count="4"> <h2><?php esc_html_e('No hemos encontrado productos', 'xstore-child'); ?></h2> <p><?php esc_html_e('Algunos productos son exclusivos para nuestros clientes', 'xstore-child'); ?></p> <p><a class="btn black medium" href="https://jaibor.com/registrarse/"> <span><?php esc_html_e('Solicita acceso para ver más', 'xstore-child'); ?></span> </a> </p> <?php echo do_shortcode('[products limit="4" tag="pulseras" orderby="date" ]'); ?> </div> <?php }
I hope it makes sense.
Thank you in advance
JacoboThe page I need help with: [log in to see the link]
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Edit no products found message on a specific tag page only’ is closed to new replies.