Set the cart language for InLine Cart

Overview

Use the Cart object to set the language of the InLine checkout by calling TwoCoInlineCart.cart.setLanguage(language-code).

Use case

  1. Add an HTML link or button in your page like the one below.

  2. Create a JavaScript click handler to execute the Inline Client desired methods.

  3. Use theTwoCoInlineCart.products.add({code, quantity, options})method to prepare your catalog product.

  4. In order to set the language use theTwoCoInlineCart.cart.setLanguage('es')method.

  5. Use theTwoCoInlineCart.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

Last updated

Was this helpful?