Skip to main content
With the $wsSubshop module, you can access subshop data. Typical use cases are language switchers or links between different country and language versions of the shop. In this section, you will learn how to read out subshop information and link between subshops.

Module overview

Example / excerpt of $wsSubshop
{{= $wsSubshop | json }}
JSON output
{
  "id": "deutsch",
  "language": {
    "isoCode": "DE",
    "name": "Deutsch"
  },
  "subshopUrl": "ƒ()",
  "subshops": ["deutsch"]
}
Note: ƒ() denotes a function. Variables and methods overview
NameTypeDescription
idstringID of the current subshop.
languagemapMap with language information of the subshop.
isoCodestringISO language code (e.g. "DE", "EN").
namestringName of the language (e.g. "Deutsch", "Englisch").
subshopsarrayList of all available subshop IDs.
subshopUrl()stringReturns the URL to the home page of the specified subshop.

Templates

Subshop data is typically used in the following places:
  • Header: language switcher between different subshops.
  • Footer: links to other country/language versions of the shop.
  • Content: country-specific notices or adjustments.

Variables

$wsSubshop.id

Returns the ID of the current subshop.
Current subshop: {{= $wsSubshop.id }}

$wsSubshop.language

Returns a map with language information of the current subshop.
Language: {{= $wsSubshop.language.name }} ({{= $wsSubshop.language.isoCode }})

$wsSubshop.language.isoCode

Returns the ISO language code of the current subshop.
ISO code: {{= $wsSubshop.language.isoCode }}

$wsSubshop.language.name

Returns the name of the language of the current subshop.
Current language: {{= $wsSubshop.language.name }}

$wsSubshop.subshops

Returns a list of all available subshop IDs. Useful for creating a language switcher or country selector.
{{ foreach $myShopId in $wsSubshop.subshops }}
  {{= $myShopId }}
{{ /foreach }}

Methods

$wsSubshop.subshopUrl()

Returns the URL to the home page of the specified subshop. The URL automatically takes into account the correct domain and path of the target subshop. Signature
$wsSubshop.subshopUrl(subshopId)
Return value
string - URL of the specified subshop.
Parameters
NameTypeRequiredDescription
subshopIdstringyesID of the target subshop.
Example that outputs the URL of a subshop.
URL: {{= $wsSubshop.subshopUrl('english') }}

Actions

No actions are available for $wsSubshop.

Examples

Set HTML lang attribute

<html lang="{{= $wsSubshop.language.isoCode | lower }}">

Display current language

<p>You are in the shop: {{= $wsSubshop.language.name }}</p>

Related links