Support multiple languages on storefronts
You can use the Storefront API to support multiple languages on a storefront. This guide explains how to retrieve translated content and create a checkout in the customer's language with the Storefront API.
RequirementsAnchor link to section titled "Requirements"
Step 1: Retrieve available languagesAnchor link to section titled "Step 1: Retrieve available languages"
For each country context, the languages available are configured within the shop’s Markets settings. The following example shows how to access the list of available languages with the
Step 2: Retrieve translationsAnchor link to section titled "Step 2: Retrieve translations"
The following example returns the Spanish translations for a product's
Step 3: Create a checkout in the customer’s languageAnchor link to section titled "Step 3: Create a checkout in the customer’s language"
@inContext directive can also be used with the
checkoutCreate mutation to set the checkout locale.
The following example creates a checkout that will load in Spanish when you redirect the customer to its
- Learn how to query international prices for products and orders, and explicitly set the context of a cart and checkout.
- Learn how to create and update a cart in Shopify with the Storefront API.
- Retrieve metafields with the Storefront API to access additional information from different types of resources.
- Learn how to manage customer accounts with the Storefront API.
- Learn about the different tools that you can use to create unique buying experiences anywhere your customers are, including websites, apps, and video games.