Scripts for multiple currencies

Create scripts that support selling in more than one currency.

Fixed or percentage-based discounts

Review how script discounts work when selling in multiple currencies. It can be difficult to market fixed-amount discounts because the amount can fluctuate with the currency conversion rates.

Methods

You can use the following methods to limit or extend discounts to specific currencies:

  • The Cart object has a new method, presentment_currency. This method returns the currency code of the customer's local (presentment) currency. For example, you could use this method to check the presentment currency of your customer and to filter your scripts based on the result.

  • The Money object has a new method, Money.derived_from_presentment(customer_cents: X). This method returns the value in the store currency. X represents the amount (formatted in cents) in the customer's local (presentment) currency. This method converts an amount in your customer's local (presentment) currency to the equivalent amount in your store currency. For example, you could use this method to show your customer their discounts in their local (presentment) currency.

Currency conversions

Shopify scripts run on your store's currency, not on your customer's local (presentment) currency:

  • Before a script runs, the amounts in your cart are converted to your store's currency.
  • After the script finishes, these amounts are converted back to your customer's local (presentment) currency.

Neither of these two conversions results in you being charged conversion fees. You are only charged conversion fees when a payment is captured.

Review your scripts before selling in multiple currencies

When you enable selling in multiple currencies, review your scripts to make sure that they still work as intended:

  • Scripts that offer a percentage discount - These scripts offer the same percentage discount regardless of the currency.
  • Scripts that offer a fixed-value discount - The values in these scripts are in the currency of your store. Scripts that offer fixed-amount discounts can be difficult to market because the amount that is discounted can fluctuate with the currency conversion rates.
  • Scripts that rely on a given price threshold to run - The values in these scripts are in the currency of your store.

Example

The following example hides all payment providers except for Shopify Payments when your customer's local (presentment) currency is different from your store currency:

Output.payment_gateways = Input.payment_gateways.delete_if do |payment_gateway|
  Input.cart.presentment_currency != Input.cart.shop_currency && payment_gateway.name != "Shopify Payments"
end

Learn more

Ready to start selling with Shopify?Try it free