• Resolved Alberto Bertolini

    (@albertolini14)


    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.

Viewing 15 replies - 1 through 15 (of 17 total)
  • Plugin Author grola

    (@grola)

    Thread Starter Alberto Bertolini

    (@albertolini14)

    Hi, 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?

    Plugin Author grola

    (@grola)

    Hi,

    did you check in a new incognito window?

    Thread Starter Alberto Bertolini

    (@albertolini14)

    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.

    Thread Starter Alberto Bertolini

    (@albertolini14)

    Maybe just put it in the filter of course ??

    Plugin Author grola

    (@grola)

    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.

    Plugin Author grola

    (@grola)

    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>'
    		);
    Thread Starter Alberto Bertolini

    (@albertolini14)

    Thank you very much, I’m happy for this evening ??

    Thread Starter Alberto Bertolini

    (@albertolini14)

    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.

    Plugin Author grola

    (@grola)

    Please paste your code here.

    Thread Starter Alberto Bertolini

    (@albertolini14)

    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.

    Plugin Author grola

    (@grola)

    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

    Thread Starter Alberto Bertolini

    (@albertolini14)

    Tested and works fine, thank you so much.

    Thread Starter Alberto Bertolini

    (@albertolini14)

    Greatly solved by Grlola

    pbianco

    (@pbianco)

    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

Viewing 15 replies - 1 through 15 (of 17 total)
  • The topic ‘Translate a message’ is closed to new replies.