Public JS API Getting started This article contains information regarding access to Public JS API and examples of its usage. Table of contents: API methods cart: TcApiCart localization: TcApiLocalization customer: TcApiCustomer Examples API methods The API contains three main types of objects: cart , localization and customer . They are accessible through the window.tcApi . The object window.tcApi returns Promise with TcApi class instance. cart : TcApiCart getTotalValue(): Promise - method returns total value of cart. getProductsValue(): Promise - method returns total value of all products in cart. getProductsQuantity(): Promise - method returns quantity of products in cart (product * quantity). getGiftsQuantity(): Promise - method returns quantity of gifts in cart. totalProducts(): Promise - method returns number of product rows in cart. totalGifts(): Promise - method returns number of gift rows in cart. getProductsSummary(): Promise - method returns ProductsSummary object interface ProductSummary { totalValue: number; productsValue: number; totalProductsQuantity: number; totalGiftsQuantity: number; totalProducts: number; totalGifts: number; } localization : TcApiLocalization getLocale(): string - current env locale. For example: pl , cs or sk . getCurrency(): string - current locale currency. For example zł in PL environment. getCurrencyIso(): string - current locale currency in ISO 4217 standard. For example PLN . getDecimalDigits(): number - number of decimal digits in prices. getMinGiftPrice(): number - miminum price for a gift. getMobileRegex(): string - mobile phone number regex pattern. getMobileDefaultPrefix(): string - mobile phone number prefix. For example: +48 . getMobilePlaceholder(): string - mobile phone number placeholder. For example: +48000000000 getPostalCodePlaceholder(): string - postal code placeholder. For example: 00-000 . getPostalCodeRegex(): string - postal code regex. For example: ^([0-9]{2}-[0-9]{3})$ . customer : TcApiCustomer isLoggedIn(): Promise - method returns authentication state of current customer. getFirstName(): Promise - method returns first name of customer if logged in. getState(): Promise - method return CustomerState object. interface CustomerState { loggedIn: boolean; firstName: string|null; } Examples Example usage of TC public JS API in CMS Blocks and CMS Pages. Methods returning a Promise type may return the target value with a slight delay. This fact should be taken into account when designing views to avoid potential issues related to Cumulative Layout Shift or empty HTML elements. Fetch and display current cart value in span element The value of your cart is Check if user is logged in and display the appropriate banner based on their status