• Dear Support!

    Today I just upgraded the new verison of the Woocommerce. Added new function.

    My problem is with the new upgrade some automatically added more function. The problem is the languages. On this website im using different languages but I am also using Loco translate plug-in which is easier to translate. Unfortunately the biggest issue is in the cart menu. When the cart is empty and clink on it and it says “Your cart is currently empty.” If i add something its fine, but my biggest problem i cant find anywhere this code to translate at all.

    My Question is where can I change it to my languages or how can i hide if someone just clink on the cart when it is empty dont see this one, because it totally different language on the website which is looks not good.
    Thank you so much your help.
    Best Regard
    Otto

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Rynald0s

    (@rynald0s)

    Automattic Happiness Engineer

    Hi @ottibass!

    You can use the wc_empty_cart_message filter to change this.

    To change the message, something like this:

    remove_action( 'woocommerce_cart_is_empty', 'wc_empty_cart_message', 10 );
    add_action( 'woocommerce_cart_is_empty', 'custom_empty_cart_message', 10 );
    
    function custom_empty_cart_message() {
        $html  = '<p class=""cart-empty woocommerce-info"">';
        $html .= wp_kses_post( apply_filters( 'wc_empty_cart_message', __( 'Your new message.', 'woocommerce' ) ) );
        echo $html . '</p>';
    }

    You can add this code to your site as per https://rynaldo.com/how-to-add-custom-code-to-your-woocommerce-wordpress-site-the-right-way/

    Cheers!

    Thread Starter ottibass

    (@ottibass)

    Hello Rynald0s (@rynald0s)

    Thank you so much!

    It is working!

    Otto

    I came here seaching for a solution since I ran into this same problem.

    I could not believe the given solution above, having to modify the code just to translate a string. It should be in the .po file, right?
    So I continued searching for a solution and finally found it in a different place. I’ll share it here in case anyone else finds this page looking for this solution.

    The text “Your cart is currently empty.” is translatable with Loco Translate.

    The problem is that Loco Translate has a file size limit for loading files. The default limit is 100K, and that’s the problem. The text “Your cart is currently empty.” is beyond the 100K boundry, so it is not loaded.
    Fortunately you can easily change the limit in the Loco Translate settings (see the setting: “Skip PHP-files that are larger than”).

    I increased the limit to 500K. Then I clicked the “Synchronize” button, and lo and behold, now the string is in the list of translatable strings and I can translate it.
    And it works.

    As a side note to the authors of the plugin…

    In the current version of Woocommerce, the file that is causing this problem has grown to just under 110K. So the 100K limit was probably broken recently.

    I can imagine that this is going to cause many more support questions in the near future, as the translation table continues to grow and more and more strings will not be shown in Loco Translate.
    So it might be a good idea to somehow split the translation table into parts, so that each part remains below 100K. I think that solution would be preferable to explaining on this website somewhere, the cause of the problem and how to solve it by increasing the size limit in the Loco Translate settings. I am sure that you know that 90% does not RTFM ??

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Your cart is currently empty translation problem’ is closed to new replies.