• Hi there! I am trying to have a custom address format that would be displayed based on the WP ML language that is currently active. We need to have a different address format based on the country where our stores are.

    I was trying to do something like this, but cannot make it work properly, I am sure you will know why:

    add_filter( ‘wpsl_address_format’, ‘custom_address_format’ );

    function custom_address_format( $address_format ) {

    if (ICL_LANGUAGE_CODE == “de”) {

    $address_format = ‘zip_city_state’;
    }
    elseif (ICL_LANGUAGE_CODE == “en”) {

    $address_format = ‘city_state_zip’;
    }
    return apply_filters( ‘wpsl_address_format’, $address_format );
    }

    I appreciate your help!

Viewing 1 replies (of 1 total)
  • Plugin Author Tijmen Smit

    (@tijmensmit)

    If you change this ‘return apply_filters( ‘wpsl_address_format’, $address_format ); into this return $address_format;

    Does that work better?

    You did check the ‘ICL_LANGUAGE_CODE’ actually contains a value?

Viewing 1 replies (of 1 total)
  • The topic ‘Custom Address Format’ is closed to new replies.