Set the cart language for InLine Cart
Last updated: 29-Feb-2024
Rate this article:
Overview
Use the Cart object to set the language of the InLine checkout by callingTwoCoInlineCart.cart.setLanguage(language-code)
.
Use case
- Add an HTML link or button in your page like the one below.
- Create a JavaScript click handler to execute the Inline Client desired methods.
- Use the
TwoCoInlineCart.products.add({code, quantity, options})
method to prepare your catalog product. - In order to set the language use the
TwoCoInlineCart.cart.setLanguage('es')
method. - Use the
TwoCoInlineCart.cart.checkout()
method to show the cart on your page.
Sample request
HTML
<a href="#" class="btn btn-success" id="buy-button">Buy now!</a>
JavaScript
window.document.getElementById('buy-button').addEventListener('click', function() {
TwoCoInlineCart.products.add({
code: "74B8E17CC0"
});
TwoCoInlineCart.cart.setLanguage('es');
TwoCoInlineCart.cart.checkout();
});
Demo
After setting the cart language using the above method, your cart should look like this:
InLine Checkout languages
English | Native | 2Checkout language codes |
---|---|---|
Arabic | العربية | ar |
Brazilian Portuguese | Português do Brasil | pt-br |
Bulgarian | български език | bg |
Chinese Mandarin Traditional | 繁体中文 | zy |
Chinese Simplified(Cantonese) | 中文 | zh |
Croatian | Hrvatski jezik | hr |
Czech | Česky | cs |
Danish | Dansk | da |
Dutch | Dutch | nl |
English | English | en |
Finnish | Suomi | fi |
French | Français | fr |
German | Deutsch | de |
Greek | Ελληνικά | el |
Hebrew | עִבְרִית | he |
Hindi | हिन्दी | hi |
Hungarian | Magyar | hu |
Italian | Italiano | it |
Japanese | 日本語 | ja |
Korean | 한국어 | ko |
Norwegian | Norsk | no |
Persian | فارسی | fa |
Polish | Polski | pl |
Portuguese | Português | pt |
Romanian | Română | ro |
Russian | Русский | ru |
Serbian | Србија | sr |
Slovak | Slovenčina | sk |
Slovenian | Slovène | sl |
Spanish | Español | es |
Swedish | Svenska | sv |
Thai | ไทย | th |
Turkish | Türkçe | tr |
Rate this article: