Support » Plugin: WooCommerce » Change the “No products in the cart” message

  • Resolved juliaangel5


    Hello, I’m trying to modify the “No products in the cart.” string in the mini cart. The mini-cart.php file is where this string is defined and I’ve already changed this string in the child template (storefront-child > woocommerce > cart) and it didn’t have any affect. So, I modified it in the parent theme, too, just to see if modifying the mini-cart.php file would have any affect there. No affect at all.

    So, no matter what I do, the “No products in the cart.” message persists.

    Can somebody please tell me which template file needs to be edited so I can change the text of that string?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support Laurena Rehbein


    Automattic Happiness Engineer

    Hi @juliaangel5,

    I’ve been playing with this on my test site, and here is what I found:

    You can do a template override. You will want to have the mini-cart.php file in your child theme, /woocommerce/cart/mini-cart.php

    The key is, that you have to add an item to your cart and remove it again, to flush the caches – you should then see your changes.

    You can also do this with a filter – again, you will need to add an item to your cart, and then remove it, to see the changes:

    * Change the “No products in the cart” message when hovering over the mini-cart

    function lar_text_strings( $translated_text, $text, $domain ) {
    switch ( $translated_text ) {
    case ‘No products in the cart.’ :
    $translated_text = __( ‘new text here’, ‘woocommerce’ );
    return $translated_text;
    add_filter( ‘gettext’, ‘lar_text_strings’, 20, 3 );

    Thread Starter juliaangel5


    Thank you Laurena. This helps a lot.


    I am having this same problem. I’ve deleted almost every string from every file that says anything about no products in cart !

    I tried adding the minicart php to my child theme too but it’s still there!
    Where did you add the referenced filter to? And is that particular to any specific theme/plugin? I don’t even care if the “no products in cart” is translated at this point i’d rather it just be gone!

    Thanks !

    • This reply was modified 1 year, 11 months ago by lissa777.

    Strangely, overriding the template file doesn’t seem to work. I’ve tried with a child theme, then adding product, clearing the mini-cart, re-adding product, re-clearing, clearing cache, nothing.

    I have even tried Loco translate plugin to translate the string. Nothing.

    The only thing that worked for me was the gettext function that @lrehbein posted above. (don’t forget to correct the ‘ ‘ quotation marks when you copy and paste it)

    • This reply was modified 1 year, 6 months ago by Joe Bloggs.
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Change the “No products in the cart” message’ is closed to new replies.