- This topic has 5 replies, 2 voices, and was last updated 4 years, 7 months ago by David.
-
AuthorPosts
-
August 13, 2019 at 7:41 am #982913Andrea
Hi guys,
I’m looking for change the “Visualizza carrello” text for the “View Cart” italian translation, into the mini cart.I’m developing locally, with GPPremium and the Merch template. All plugins, WordPress and themes are updated to the latest version and I don’t use cache plugins.
1 I tried with Loco translate, and it doesn’t work.
____2 I tried with:
add_filter( 'gettext', function( $translated_text ) { if ( 'View your shopping cart' === $translated_text ) { $translated_text = 'Your new text here'; } return $translated_text; } );
As written in this topic: https://generatepress.com/forums/topic/change-to-spanish-or-erase-titleview-your-shopping-cart/#post-912300
but it still does not work.
____3 So I tried similar solutions described on stackoverflow, like this:
function translate_text ($ translated) { $ translated = str_ireplace ('Kasse', 'Weiter zur Kasse', $ translated); return $ translated; } add_filter ('gettext', 'translate_text', 999); add_filter ('ngettext', 'translate_text', 999);
But it doesn’t seem to work.
____4 I started combing the GP premium core and noticed that in:
gp-premium / woocommerce / functions / functions.php
on line 505 the WC_Widget_Cart class is called.I found this discussion about this: https://wpml.org/forums/topic/wpml-the_widgetwc_widget_cart/
I don’t use wpml, so compatibility is not absolutely necessary.
I would just like to find a way to modify the string and I hope this can help you understand it better.Thank you so much for your time.
Sorry for my English.
Andrea
August 13, 2019 at 9:57 am #983205DavidStaffCustomer SupportHi there,
the second option you tried ie this:
Try changing this part of the code:
if ( 'View your shopping cart'
to:
if ( 'View cart'
August 13, 2019 at 2:55 pm #983436AndreaHi David,
thank you for your reply.
It still does not work.
I’m trying other ways. If I can solve it, I’ll write it below.August 13, 2019 at 3:41 pm #983461DavidStaffCustomer SupportCan you make sure that the string of text you’re looking to replace is exactly the same as what you see on the Button?
So my button says ‘View cart’ – if you’re in a different language then make sure it says exactly what you see, making sure any capital letts or other characters are included.
August 16, 2019 at 4:00 am #985540AndreaHi David,
all the options described work correctly.
I had no idea that the mini-cart is being cached somewhere.
https://github.com/woocommerce/woocommerce/issues/15375Many thanks for support!
Andrea
August 16, 2019 at 5:36 am #985593DavidStaffCustomer SupportAwesome – glad to be of help.
-
AuthorPosts
- You must be logged in to reply to this topic.