Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1222223
    Ying-Fu Li
    Participant

    Hi,

    On attached image you can see that ‘Your Cart is Empty’ and ‘Return To Shop’ are not translated. Nevertheless I do have the Dutch .po files for woocommerce and woocommerce-admin in /wp-content/languages/plugins/. Can you help me with this? Site: http://www.dehartenvriend.nl/winkelmand/

    Another question: how can I get the ‘Return To Shop’ button to link to a custom page instead of the default shop-template?

    #1222448
    Lely
    Moderator

    Hi There,

    Thanks for posting in.
    Those text are ready to be translated. To translate properly, please check out our knowledge base here: https://community.theme.co/kb/translation/

    Other option is we can just add the following code on your child theme’s functions.php file.

    add_filter ('gettext', 'x_translate_text', 99, 3 );
    
    function x_translate_text ( $translated_text, $text, $domain ) {
    
    $translation = array (
    'Your cart is currently empty.' => 'Dutch Translation',
    'Return To Shop' => 'Dutch Translation'
    );
    
    if( isset( $translation[$text] ) ) {
    return $translation[$text];
    }
    
    return $translated_text;
    
    } 

    Update Dutch Translation accordingly.

    To update Return to Shop button link, please copy cart-empty.php from this folder \wp-content\themes\x\woocommerce\cart to this folder on your child theme \wp-content\themes\x-child\woocommerce\cart. If you don’t have any woocommerce customizations yet, those location doesn’t exist on your child theme yet. You need to create those folder first. Then open the copied file. Look for the following lines:
    <a class="button wc-backward" href="<?php echo esc_url( apply_filters( 'woocommerce_return_to_shop_redirect', wc_get_page_permalink( 'shop' ) ) ); ?>">
    Update the href values to your custom page URL.

    Hope this helps.

    #1222677
    Ying-Fu Li
    Participant

    Hi,

    Thanks for the work around, I’ll give it a go. No need to point me to translation tutorials: all is done on this site but it just won’t catch on for some elements.

    #1222686
    Ying-Fu Li
    Participant
    This reply has been marked as private.
    #1222691
    Ying-Fu Li
    Participant

    Also, the workaround for the ‘Return to shop’ link doesn’t work. It can’t seem to find the page I set.

    <p class="return-to-shop">
    		<a class="button wc-backward" href=“http://www.dehartenvriend.nl”>
    			<?php _e( 'Return To Shop', 'woocommerce' ) ?>
    #1222742
    Ying-Fu Li
    Participant

    Added some code I found elsewhere on the forum. Still can’t get it to point to my custom url: http://www.dehartenvriend.nl/hartenwinkel/ I did get so far that now, unintended, it leads to the homepage. Why is this so difficult to do?

    #1223173
    Rad
    Moderator

    Hi there,,

    I checked and they are translated on my end. It says “Terug naar de Winkel”.

    About the URL, it should be under \wp-content\themes\x\woocommerce\cart\cart-empty.php , and you can change its URL by adding this code to your child theme’s functions.php

    add_filter('woocommerce_return_to_shop_redirect, 'shop_custom_link', 999);
    
    function shop_custom_link ( $link ) {
    
    return 'http://example.com/shop/';
    
    }

    Hope this helps.

    #1223612
    Ying-Fu Li
    Participant

    The translation caught on after I installed the woocommerce folder in the child theme folder. When I remove it the translation is gone.

    The URL is impossible to change. You’re above tip didn’t work. For one, using \wp-content\themes\x\woocommerce\cart\cart-empty.php does nothing. Adding the add_filter to the child theme’s functions.php results in a blank website.

    How is this possible? And I really need this URL-workaround.

    #1223681
    Lely
    Moderator

    Hi There,

    From what you have shared, it is not working because of pretty quotes:

    <p class="return-to-shop">
    		<a class="button wc-backward" href=“http://www.dehartenvriend.nl”>
    			<?php _e( 'Return To Shop', 'woocommerce' ) ?>

    Update that code to this:

    <p class="return-to-shop">
    		<a class="button wc-backward" href="http://www.dehartenvriend.nl/">
    			<?php _e( 'Return To Shop', 'woocommerce' ) ?>

    Href option is using pretty quotes which is an error.

    Hope this helps.

    #1223721
    Ying-Fu Li
    Participant

    That only links to the homepage. Big sigh…

    #1224033
    Lely
    Moderator

    Hi There,

    I am not sure if I got your issue. Feel free to update the href value.

    #1225264
    Ying-Fu Li
    Participant

    The last code you gave me only links back to the homepage of my site, not the page of which I added the url for.

    So here it is: the return to shop-button either links to the homepage or the default woocommerce shop-page. No matter what I try, it never links back to the page I actually want it to link back to. I am at a loss right, as the shop needs to be online and I can’t have it linking to woocommerce’s default shop-page.

    I don’t understand why such a customization is such a problem when woocommerce itself flaunts the use of shortcodes so you can make your own shop pages.

    #1225310
    Ying-Fu Li
    Participant

    Added this to functions.php:

    function wc_empty_cart_redirect_url() {
    	return 'http://dehartenvriend.nl/hartenwinkel/';
    }
    add_filter( 'woocommerce_return_to_shop_redirect', 'wc_empty_cart_redirect_url' );

    and that worked.

    #1225438
    Joao
    Moderator

    Glad to hear it,

    Joao

  • <script> jQuery(function($){ $("#no-reply-1222223 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>