Support » Plugin: Code Snippets » Snippets for multi-language site

  • Resolved moegnd

    (@moegnd)


    Hi,

    So I’m using a snippet to change the price view on my Woocommerce from a range to from:

    I’m using this snippet and its working fine but I only want it to work on my English site.

    function iconic_format_price_range( $price, $from, $to ) {
    return sprintf( ‘%s: %s’, __( ‘from’, ‘iconic’ ), wc_price( $from ) );
    }

    add_filter( ‘woocommerce_format_price_range’, ‘iconic_format_price_range’, 10, 3 );

    Then I want to make another one to work only on the Arabic version of the website:

    function iconic_format_price_range( $price, $from, $to ) {
    return sprintf( ‘%s: %s’, __( ‘من’, ‘iconic’ ), wc_price( $from ) );
    }

    add_filter( ‘woocommerce_format_price_range’, ‘iconic_format_price_range’, 10, 3 );

    How is that possible?

    Regards

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Shea Bunge

    (@bungeshea)

    Hi @moegnd,

    What sort of mechanism are you using for changing between the English and Arabic sites? Some sort of plugin?

    Thread Starter moegnd

    (@moegnd)

    Hi @bungeshea

    Thank you for you reply,

    I’m using WPML.

    Plugin Author Shea Bunge

    (@bungeshea)

    Hi @moegnd,

    It looks like the ICL_LANGUAGE_CODE should give you the current language.

    Hope this helps!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Snippets for multi-language site’ is closed to new replies.