Skip to main content
With the $wsConfig module, you read the shop’s configuration data in the frontend, for example the available countries, the currency, the payment and shipping methods, and the configured salutations and titles. This page is about reading the configuration. The configuration itself is maintained in the admin interface or via code, not through this module.

Basic concept

$wsConfig is a read-only module. It reflects the configuration stored in the shop at the time the page is built. The values change only when the configuration is changed and not as a result of a customer action. The variables can be grouped as follows:

Format currency

The currency filter (| currency) outputs an amount with the currency symbol already included (e.g. 1,500.00 €). For this reason, do not use currency.symbol in addition to | currency – otherwise the symbol will appear twice. You only need currency.symbol if you format a value yourself or display the symbol on its own.

Module overview

Example / excerpt of $wsConfig
{{= $wsConfig | json }}
JSON output
{
  "countries": [ { "isoAlpha2": "...", "isoAlpha3": "...", "isoNum": "...", "name": "..." } ],
  "currency": { "symbol": "...", "isoCode": "...", "isoNum": "..." },
  "directOrder": { "initialNumber": 0, "maximalNumber": 0, "refreshedNumber": 0, "itemNumberFields": [...] },
  "emails": [...],
  "listElements": { "bill": { }, "delivery": { } },
  "passwordChecks": { "maxLength": { "len": 0 }, "minLength": { "len": 0 } },
  "passwordReset": { "checkLoginID": false, "checkOldPassword": false },
  "payments": [ { "id": "...", "name": "...", "description": "...", "image": "..." } ],
  "redirects": [...],
  "salutation": { "codeList": [ { "code": "...", "text": "..." } ] },
  "shippingMethods": [ { "id": "...", "name": "...", "description": "...", "image": "...", "link": "...", "type": "..." } ],
  "title": { "codeList": [ { "code": "...", "text": "..." } ] }
}
Variables overview
VariableTypeDescription
countriesarrayConfigured countries (structure see below).
currencymapCurrency data (symbol, codes).
salutationmapConfigured salutations (under codeList).
titlemapConfigured titles (under codeList).
paymentsarrayConfigured payment methods (structure see below).
shippingMethodsarrayConfigured shipping methods (structure see below).
listElementsmapAddress type options for forms (bill, delivery).
passwordChecksmapPassword length rules.
passwordResetmapPassword reset settings.
directOrdermapDirect order settings.
emailsarrayEmail configurations.
redirectsarrayRedirect configurations.
b2bSubAccountsmapB2B sub-account settings (subAccountsEnabled, adminCanEditMemberAddresses).
shippingMethodGroupsarrayGroups of shipping methods (empty in test).

Templates

The configuration data can be used on any page. Typical use cases: forms (country and salutation selection), checkout (payment and shipping methods), and price display (currency).

Variables

$wsConfig.countries

Returns the configured countries. Use the list, for example, to populate a country select field in an address form.
{{ foreach $country in $wsConfig.countries }}
  {{= $country.name }} ({{= $country.isoAlpha2 }})
{{ /foreach }}

Properties of a country

PropertyTypeDescription
namestringName of the country.
isoAlpha2stringISO-2 country code (e.g. "DE", "AT").
isoAlpha3stringISO-3 country code (e.g. "DEU", "AUT").
isoNumstringISO numeric code (e.g. "276", "040").

$wsConfig.currency

Returns the currency data. To display an amount, you generally use the currency filter (see Format currency).

Properties of $wsConfig.currency

PropertyTypeDescription
symbolstringCurrency symbol (e.g. ).
isoCodestringISO currency code (e.g. "EUR").
isoNumstringISO numeric code of the currency (e.g. "978").
Currency: {{= $wsConfig.currency.isoCode }} ({{= $wsConfig.currency.symbol }})

$wsConfig.salutation

Returns the configured salutations. The actual list is found under salutation.codeList. Use it, for example, to populate a salutation select field.
{{ foreach $salutation in $wsConfig.salutation.codeList }}
  {{= $salutation.text }}
{{ /foreach }}

Properties of an entry in salutation.codeList

PropertyTypeDescription
codestringSalutation code (e.g. "1", "2").
textstringDisplay text (e.g. "Mr.", "Mrs.", "Family", "Company").

$wsConfig.title

Returns the configured titles. The list is found under title.codeList. The structure is analogous to salutation.
{{ foreach $title in $wsConfig.title.codeList }}
  {{= $title.text }}
{{ /foreach }}

Properties of an entry in title.codeList

PropertyTypeDescription
codestringTitle code (e.g. "1").
textstringDisplay text (e.g. "Dr.", "Prof."; can be empty).

$wsConfig.payments

Returns the configured payment methods. Use it to display the available payment methods.
{{ foreach $payment in $wsConfig.payments }}
  {{= $payment.name }}: {{= $payment.description }}
{{ /foreach }}

Properties of a payment method

PropertyTypeDescription
idstringID of the payment method (e.g. "paypalCheckout", "stripe").
namestringName of the payment method.
descriptionstringDescription of the payment method.
imagestringImage URL of the payment method.
discountfloatDiscount of the payment method.
providerstringProvider of the payment method.
typestringType of the payment method.
labelsarrayLabels of the payment method.
displayInfoarrayAdditional display information (see note).
displayInfo is only populated if the displayPaymentTypes parameter has been configured for the payment method. Each entry contains name, description and image.
{{ foreach $payment in $wsConfig.payments }}
  {{ foreach $info in $payment.displayInfo }}
    {{= $info.name }} – {{= $info.description }}
  {{ /foreach }}
{{ /foreach }}

$wsConfig.shippingMethods

Returns the configured shipping methods.
{{ foreach $shipping in $wsConfig.shippingMethods }}
  {{= $shipping.name }} ({{= $shipping.type }})
{{ /foreach }}

Properties of a shipping method

PropertyTypeDescription
idstringID of the shipping method (e.g. "dhl").
namestringName of the shipping method.
descriptionstringDescription of the shipping method.
imagestringImage URL of the shipping method.
linkstringLink to the shipping method (e.g. tracking page).
typestringType of the shipping method (e.g. "standard").
groupstringAssigned shipping method group (can be null).
The shipping costs are not part of the configuration. They depend on the basket and are determined via $wsCheckout.getShippingCost(shippingMethodId).

$wsConfig.listElements

Returns the address type options for forms, separated by bill (billing address) and delivery (shipping address), for example private / company.
{{ foreach $list in $wsConfig.listElements.bill }}
  <select name="addressType">
    {{ foreach $option in $list.values }}
      <option value="{{= $option.value }}"{{ if $option.value == $list.defaultValue }} selected{{ /if }}>
        {{= $option.name }}
      </option>
    {{ /foreach }}
  </select>
{{ /foreach }}

Properties of an entry in listElements.bill / .delivery

PropertyTypeDescription
defaultValuestringPreselected value (e.g. "1").
valuesarrayOptions, each { name, value }

$wsConfig.passwordChecks

Returns the length rules for passwords. Use them, for example, to display the allowed length in a registration or password form, or to validate client-side.
Password length: {{= $wsConfig.passwordChecks.minLength.len }} to {{= $wsConfig.passwordChecks.maxLength.len }} characters

Properties of $wsConfig.passwordChecks

PropertyTypeDescription
minLength.lenintMinimum password length.
maxLength.lenintMaximum password length.

$wsConfig.passwordReset

Returns the password reset settings.
{{ if $wsConfig.passwordReset.checkOldPassword }}
  <!-- Old password required when resetting -->
{{ /if }}

Properties of $wsConfig.passwordReset

PropertyTypeDescription
checkLoginIDboolWhether the login ID is checked on reset.
checkOldPasswordboolWhether the old password is checked on reset.

$wsConfig.directOrder

Returns the direct order settings (e.g. how many input lines are displayed).
Initial lines: {{= $wsConfig.directOrder.initialNumber }}
Max. lines: {{= $wsConfig.directOrder.maximalNumber }}

Properties of $wsConfig.directOrder

PropertyTypeDescription
initialNumberintNumber of initially displayed lines.
maximalNumberintMaximum number of lines.
refreshedNumberintNumber of newly loaded lines.
itemNumberFieldsarrayItem number fields of the direct order.

$wsConfig.emails

Returns the email configurations.
{{= $wsConfig.emails | json }}

$wsConfig.redirects

Returns the redirect configurations.
{{= $wsConfig.redirects | json }}

Methods

No methods are available for $wsConfig.

Actions

No actions are available for $wsConfig.

Examples

Country select field

<select name="country">
  {{ foreach $country in $wsConfig.countries }}
    <option value="{{= $country.isoAlpha2 }}">{{= $country.name }}</option>
  {{ /foreach }}
</select>
Result
A select field with all configured countries. The value is the ISO-2 code.

Salutation select field

<select name="salutation">
  {{ foreach $salutation in $wsConfig.salutation.codeList }}
    <option value="{{= $salutation.code }}">{{= $salutation.text }}</option>
  {{ /foreach }}
</select>
Result
A select field with all configured salutations.

List payment methods

{{ foreach $payment in $wsConfig.payments }}
  <p>{{= $payment.name }} – {{= $payment.description }}</p>
{{ /foreach }}
Result
All configured payment methods with name and description.

Display the currency correctly

Subtotal: {{= $wsBasket.totalGross | currency }}
Result
The amount is output with the currency symbol (e.g. 1,500.00 €).