Search code examples
phpwordpresswoocommercetranslation

Modify html from woocomerce


I'm using woodmart theme, woocommerce and i can't find a way to translate these two elements "Wishlist" and "Logout" without using plugins Usually when we change the website's language woocomerce does as well, well actually it did, but these two are still the same. Now i'm just trying to find where their Html is and just change it but i couldn't find itScreenShot

i inspected the elements, copied their classes, used vsCode to search for those classes but no results were found except for this class " woocommerce-MyAccount-navigation-link " but it only found css


Solution

  • Here is how i fixed the problem Using 'gettext' :

    add_filter( 'gettext', 'rename_logout_wishlist_text', 10, 3 );
    function rename_logout_wishlist_text( $translated_text, $text, $domain ) 
    {
    if ( $text === 'Logout' ) {
        $translated_text = 'Déconnexion';
    }
    if ( $text === 'Wishlist' ) {
        $translated_text = 'Liste de souhaits';
    }
    return $translated_text;
    }