Different currencies
Learn how to sell products in multiple currencies on Easycart, manage currency settings, and ensure proper tax calculations.
With Easytools, you can sell in any of the 135+ currencies supported by Stripe. Each product can only have one assigned currency. Currently, we do not support dynamic currency switching based on the buyer's country for a single product.
When selling in different currencies to customers from various countries, ensure that taxes are correctly calculated in the checkout based on the customer's location and your tax jurisdictions. Make sure you have enabled foreign sales tax support, especially tax calculation at checkout, provided by Easybilling. You can read more about taxes and their settings here.
The balance on Stripe, which you accumulate from payments in different currencies, will either be converted to your primary currency and paid out to your main account or remain in the currency paid by customers if you have added it to your Stripe payout settings and linked it to the respective payout account.
To sell the same product in different currencies, duplicate the product and choose a different currency and price for the clone. Then, link the appropriate currencies separately on your sales pages.
Advanced: Switch links to products (and currencies) depending on the visitor's country
You can also use a script to detect the visitor's country and switch the checkout link to the appropriate currency. You can use the Intl API to get the user's country code based on their location and update the links accordingly.
Here is a basic JavaScript script to do this, which you need to add to the <head>
section of your page within tags <script>...</script>.
// Function to determine user's country
function getUserCountry() {
const locale = navigator.language || navigator.userLanguage;
const countryCode = locale.split('-').pop(); // Extracts the country code from the locale
return countryCode.toUpperCase();
}
// Function to update the links based on the country code
function updateLinksForCountry() {
const countryCode = getUserCountry();
const links = document.querySelectorAll('.localized-link'); // Assume links have this class
links.forEach(link => {
const baseUrl = link.dataset.baseUrl; // The base URL without the country code
const newUrl = `${baseUrl}/${countryCode}123`;
link.href = newUrl;
});
}
// When the document is ready, update the links
document.addEventListener('DOMContentLoaded', function() {
updateLinksForCountry();
});
Next, in your HTML code, ensure your links are set up with the data-base-url
attribute and the localized-link
class:
<a href="#" class="localized-link" data-base-url="<https://easl.ink>">Click here</a>
<a href="#" class="localized-link" data-base-url="<https://easl.ink>">Another link</a>
- For a user from the UK, the link will be updated to
https://easl.ink/GB123
- For a user from Spain, it will be updated to
https://easl.ink/ES123
This script dynamically updates the links based on the user's location, making it easier to serve region-specific links.
How it works?
Function getUserCountry
This function fetches the user's location using navigator.language
or navigator.userLanguage
. It then extracts the country code from the locale (e.g., from "en-GB" it extracts "GB").
Function updateLinksForCountry
This function selects all elements with the class .localized-link
. For each link, it creates a new URL by adding the country code to the base URL stored in the link's data-base-url
attribute. Finally, it updates each link's href attribute with the new URL.
DOMContentLoaded event
The script waits until the HTML document is fully loaded before running the function updateLinksForCountry