Translate a message
-
Hi, I need to translate the message that appears when setting a free shipping cap (You only need € 20,40 more to get free shipping! CONTINUE SHOPPING), but I can’t find where it is located, I tried with the “loco translate” plugin but this too doesn’t find the string to translate, what can I do?
Thank you.
-
Hi,
it can be done via custom code: https://docs.flexibleshipping.com/article/915-flexible-shipping-advanced-options-customization#’Left_to_free_shipping’_notice_customization
Best regards,
GrzegorzHi, thanks for your tip, I applied the code in my child theme function.php file but nothing has changed, maybe I’m putting it in the wrong place?
Hi,
did you check in a new incognito window?
Well, the site is still in production so now I have tried incognito and it works, I take advantage of your courtesy for one more detail if you can help me understand how to recover the “back to shop” link too, it would be fantastic, thanks anyway.
Maybe just put it in the filter of course 🙂
The original message also includes the link text: ‘You only need %1$s more to get free shipping! %2$sContinue shopping%3$s’ so you can translate it as well.
Full code for original text:
$notice_text = sprintf( // Translators: cart value and shop link. __( 'You only need %1$s more to get free shipping! %2$sContinue shopping%3$s', 'flexible-shipping' ), wc_price( $amount ), '<a class="button" href="' . esc_url( apply_filters( 'woocommerce_return_to_shop_redirect', wc_get_page_permalink( 'shop' ) ) ) . '">', '</a>' );Thank you very much, I’m happy for this evening 😀
Oops, maybe I’m still doing something wrong, I copied the code (twice for safety) and did the test in an anonymous window, but I don’t see the translation, the original text comes out.
Please paste your code here.
The first one work fine:
add_filter( 'flexible_shipping_free_shipping_notice_text', 'wpdesk_flexible_shipping_free_shipping_notice_text', 10, 2 ); function wpdesk_flexible_shipping_free_shipping_notice_text( $notice_text, $amount ) { return sprintf( 'Mancano ancora %1$s per ottenere la consegna gratuita!', wc_price( $amount ) ); }The complete code you gave me above I simply copied and pasted in place of the previous one, forgive me but I’m not a programmer, maybe I need to integrate it with the first one?
Thanks for your patience.Use this code below:
add_filter( 'flexible_shipping_free_shipping_notice_text', 'wpdesk_flexible_shipping_free_shipping_notice_text', 10, 2 ); function wpdesk_flexible_shipping_free_shipping_notice_text( $notice_text, $amount ) { return sprintf( 'You only need %1$s more to get free shipping! %2$sContinue shopping%3$s', wc_price( $amount ), '<a class="button" href="' . esc_url( apply_filters( 'woocommerce_return_to_shop_redirect', wc_get_page_permalink( 'shop' ) ) ) . '">', '</a>' ); }of course translate the message text and the link text
Tested and works fine, thank you so much.
Greatly solved by Grlola
Hi Alberto, can you help me to solve my identical issue.
How and where to paste that code. I’ve try in funcion.php but it doesn’t works
Maybe have I to add this code inside sone special tags like function or other?
I still see You only miss…. And not in italian as I need.
Thanks
Paolo
The topic ‘Translate a message’ is closed to new replies.