Support

Home Forums Event Espresso Premium How to change default country (US) at paypal guest checkout

How to change default country (US) at paypal guest checkout

Posted: February 9, 2018 at 6:48 am

Viewing 6 reply threads


James Murrin

February 9, 2018 at 6:48 am

Hello, we’re using Paypal express, and when I get to the Paypal guest checkout, the default country is set to US. I have to click to select UK, which is an extra click I’d like our clients to not have to do.
In EE->general settings -> countries, I’ve set it to United Kingdom and the country ISO code is GB and the ISO3 is GBR.

Is there somewhere else I need to change something to switch Paypal into UK mode?
Thank you for your help.

Dee


Josh

  • Support Staff

February 9, 2018 at 9:31 am

Hi Dee,

I checked into this and I could not find a clear answer from PayPal about this. A number of possible solutions were outlined here:

https://www.paypal-community.com/t5/Merchant-services-Archive/Billing-Information-Default-Country/td-p/319374

If the solution is to the send PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE along with the request, then you can add the following code to do that:

add_filter(
    'FHEE__EEG_Paypal_Express__set_redirection_info__arguments', 
    'my_add_country_code_to_paypal', 
    10, 
    2
);
function my_add_country_code_to_paypal($token_request_dtls, $object) {
    $token_request_dtls['PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE'] = 'GB';
    return $token_request_dtls;
}

You can add the above to a functions plugin then activate the plugin if one isn’t activated already.


James Murrin

February 9, 2018 at 12:46 pm

Hi Josh

I put this into my functions.php file (that’s the same thing right?) and sadly it didn’t work. I tried purging the cache too and tried again, still defaulting to US of A. Is there something else I can try or test to see where it might be going wrong? Many thanks. Dee


Josh

  • Support Staff

February 9, 2018 at 3:22 pm

Hi Dee,

The theme’s functions.php file isn’t the same thing because it loads too late. So you could try the code within the plugin to make sure it loads in time, then check the logs in Event Espresso > Payment Methods > Logs where you’ll actually see the PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE set to GB in the request.

If setting PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE to GB still results in defaulting to USA, then you’ll need to contact PayPal support.


James Murrin

February 14, 2018 at 10:23 am

Hi Josh

I tried that as a plugin, and can confirm that the payment log showed that the country code was being sent to Paypal. Here it is:
PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE GB
But, it didn’t work. Still, the default country was United Stated for the guest checkout.

I looked at the log more closely and also saw this was being sent to paypal:
LOCALECODE US

Do you think it is this which is setting the local experience for the user to be United states?

I’ve confirmed that all the general settings -> countries are set to GB. Please could you tell me where this LOCALECODE US is coming from?

Many thanks.

Dee


Josh

  • Support Staff

February 14, 2018 at 11:24 am

LOCALECODE US comes from what’s set in WP > Settings > General > Site Language. If that option is currently set to English (United States) you can change it to be English (UK).


James Murrin

February 14, 2018 at 3:42 pm

Hi Josh

That fixed the problem beautifully! I was on English (US) and now I’ve switched to English (UK). Thank you very much for your help. Dee

Viewing 6 reply threads

The support post ‘How to change default country (US) at paypal guest checkout’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso