Tagged: x
-
AuthorPosts
-
October 19, 2016 at 7:57 am #1222223
Ying-Fu LiParticipantHi,
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?
October 19, 2016 at 10:56 am #1222448
LelyModeratorHi 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.
October 19, 2016 at 1:27 pm #1222677
Ying-Fu LiParticipantHi,
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.
October 19, 2016 at 1:34 pm #1222686
Ying-Fu LiParticipantThis reply has been marked as private.October 19, 2016 at 1:38 pm #1222691
Ying-Fu LiParticipantAlso, 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' ) ?>October 19, 2016 at 2:15 pm #1222742
Ying-Fu LiParticipantAdded 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?
October 19, 2016 at 8:41 pm #1223173
RadModeratorHi 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.
October 20, 2016 at 3:57 am #1223612
Ying-Fu LiParticipantThe 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.
October 20, 2016 at 5:05 am #1223681
LelyModeratorHi 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.
October 20, 2016 at 5:50 am #1223721
Ying-Fu LiParticipantThat only links to the homepage. Big sigh…
October 20, 2016 at 10:30 am #1224033
LelyModeratorHi There,
I am not sure if I got your issue. Feel free to update the href value.
October 21, 2016 at 6:16 am #1225264
Ying-Fu LiParticipantThe 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.
October 21, 2016 at 6:52 am #1225310
Ying-Fu LiParticipantAdded 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.
October 21, 2016 at 8:42 am #1225438
JoaoModeratorGlad to hear it,
Joao
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-1222223 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
