Support » Plugin: WooCommerce PayPal Checkout Payment Gateway » Change Default Country from US to Ireland

  • Resolved gavodel

    (@gavodel)


    Hi,

    So we are using your plugin on our site,

    when we choose the debit card option it defaults to US instead of Ireland like it should,

    I see elsewhere you can change the language on the Website away from English(US) and it will change the default country, and this works for English(UK), but we want it to show Ireland as the default, but English(Ireland) isn’t an option,

    can you let me know how to fix this?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor AW a11n

    (@slash1andy)

    Automattic Happiness Engineer

    Hey there!

    Can you tell me more about what you are meaning when you say it’s defaulting to US?

    A link to where we can see this in action would be helpful.”

    Have a great one!

    Plugin Author mattdallan

    (@mattdallan)

    Hi @gavodel,

    The default country you’re referring to is set by the local code that we send to PayPal when rendering the PayPal buttons on the page.

    When I look up Ireland in the list of PayPal’s supported locale codes, I don’t see a unique locale code and it just says to use United States English (en_US): https://developer.paypal.com/docs/api/reference/locale-codes/#supported-locale-codes

    Even though it’s not documented by PayPal I have just tested using ‘en_IE’ as the locale code and that produces the desired outcome you’re looking for: https://d.pr/i/RaTv26

    In order to customise the locale_code you will need to add the following code snippet to your functions.php:

    
    function gavodel_ppec_use_ireland_locale_code( $default_code ) {
        return 'en_IE';
    }
    
    add_filter( 'woocommerce_paypal_express_checkout_paypal_locale', 'gavodel_ppec_use_ireland_locale_code', 10, 1 );
    

    Let me know how that goes.

    Cheers!

    Plugin Support Joey – a11n

    (@jricketts4)

    We haven’t heard back from you in a while, so I’m going to mark this as resolved – if you have any further questions, you can start a new thread.

    – Joey

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Change Default Country from US to Ireland’ is closed to new replies.