Currency Code and Current User Location


I’m just wondering if anyone has done something like this, or whether I’m just thinking about it all wrong.

In some of the plugin’s like Stripe or PayPal there’s the currency code field, as shown below.


I have these set to GBP which work fine and I assume that currency code is passed to Stripe/PayPal etc as needed, but this is just for the UK and since these fields are dynamic I’m wondering how you’d make the currency code dynamic based upon the current geographic location (country) that a user might be logged in with.

Would you need a new table or something outlining all the countries and codes, then do some type of calculation/search on it to get the correct one for the current user? I can’t think of a way where you can get the currency code based on a dynamic value like this.