Introduction

For Shopify stores that have the Rye Shopify app installed, some Rye API operations support localization for price value and currency. This means that you can use the Rye API to get the price value and currency in the language and currency that the customer prefers. To enable localization, you should pass a header that includes information about the preferred country and currency. Note that the Shopify store must have local currencies enabled for this feature to work within Rye.

For localization, the Rye API expects a header key of x-rye-localization-context to be passed with certain GraphQL requests. The value should be a base64-encoded string of a JSON object that resembles the following:

{
  "countryCode": "CA",
  "currencyCode": "CAD"
}

This value would be encoded as the base64 string ewogICJjb3VudHJ5Q29kZSI6ICJDQSIsCiAgImN1cnJlbmN5Q29kZSI6ICJDQUQiCn0= and passed as the value of the x-rye-localization-context header. Here’s a more in-depth example using a Shopify store that defaults to USD, but supports CAD currency:

Example request and response without localization (default USD)

{
	"Content-Type": "application/json",
	"Authorization": "Basic YOUR_KEY_HERE"
}

Example request and response with localization (CAD)

{
	"Content-Type": "application/json",
	"Authorization": "Basic YOUR_KEY_HERE",
	"X-Rye-Localization-Context": "ewogICJjb3VudHJ5Q29kZSI6ICJDQSIsCiAgImN1cnJlbmN5Q29kZSI6ICJDQUQiCn0="
}

Supported operations