$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:
- Lists for forms –
countries,salutation,title,listElements: populate, e.g., select fields in address and login forms. - Checkout options –
payments,shippingMethods: the available payment and shipping methods. - Display –
currency: currency symbol and codes. - Behavior and security –
passwordChecks,passwordReset,directOrder,redirects,emails.
Format currency
Thecurrency 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
| Variable | Type | Description |
|---|---|---|
countries | array | Configured countries (structure see below). |
currency | map | Currency data (symbol, codes). |
salutation | map | Configured salutations (under codeList). |
title | map | Configured titles (under codeList). |
payments | array | Configured payment methods (structure see below). |
shippingMethods | array | Configured shipping methods (structure see below). |
listElements | map | Address type options for forms (bill, delivery). |
passwordChecks | map | Password length rules. |
passwordReset | map | Password reset settings. |
directOrder | map | Direct order settings. |
emails | array | Email configurations. |
redirects | array | Redirect configurations. |
b2bSubAccounts | map | B2B sub-account settings (subAccountsEnabled, adminCanEditMemberAddresses). |
shippingMethodGroups | array | Groups 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.Properties of a country
| Property | Type | Description |
|---|---|---|
name | string | Name of the country. |
isoAlpha2 | string | ISO-2 country code (e.g. "DE", "AT"). |
isoAlpha3 | string | ISO-3 country code (e.g. "DEU", "AUT"). |
isoNum | string | ISO numeric code (e.g. "276", "040"). |
$wsConfig.currency
Returns the currency data. To display an amount, you generally use thecurrency filter (see Format currency).
Properties of $wsConfig.currency
| Property | Type | Description |
|---|---|---|
symbol | string | Currency symbol (e.g. €). |
isoCode | string | ISO currency code (e.g. "EUR"). |
isoNum | string | ISO numeric code of the currency (e.g. "978"). |
$wsConfig.salutation
Returns the configured salutations. The actual list is found undersalutation.codeList. Use it, for example, to populate a salutation select field.
Properties of an entry in salutation.codeList
| Property | Type | Description |
|---|---|---|
code | string | Salutation code (e.g. "1", "2"). |
text | string | Display text (e.g. "Mr.", "Mrs.", "Family", "Company"). |
$wsConfig.title
Returns the configured titles. The list is found undertitle.codeList. The structure is analogous to salutation.
Properties of an entry in title.codeList
| Property | Type | Description |
|---|---|---|
code | string | Title code (e.g. "1"). |
text | string | Display text (e.g. "Dr.", "Prof."; can be empty). |
$wsConfig.payments
Returns the configured payment methods. Use it to display the available payment methods.Properties of a payment method
| Property | Type | Description |
|---|---|---|
id | string | ID of the payment method (e.g. "paypalCheckout", "stripe"). |
name | string | Name of the payment method. |
description | string | Description of the payment method. |
image | string | Image URL of the payment method. |
discount | float | Discount of the payment method. |
provider | string | Provider of the payment method. |
type | string | Type of the payment method. |
labels | array | Labels of the payment method. |
displayInfo | array | Additional 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.
$wsConfig.shippingMethods
Returns the configured shipping methods.Properties of a shipping method
| Property | Type | Description |
|---|---|---|
id | string | ID of the shipping method (e.g. "dhl"). |
name | string | Name of the shipping method. |
description | string | Description of the shipping method. |
image | string | Image URL of the shipping method. |
link | string | Link to the shipping method (e.g. tracking page). |
type | string | Type of the shipping method (e.g. "standard"). |
group | string | Assigned 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 bybill (billing address) and delivery (shipping address), for example private / company.
Properties of an entry in listElements.bill / .delivery
| Property | Type | Description |
|---|---|---|
defaultValue | string | Preselected value (e.g. "1"). |
values | array | Options, 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.Properties of $wsConfig.passwordChecks
| Property | Type | Description |
|---|---|---|
minLength.len | int | Minimum password length. |
maxLength.len | int | Maximum password length. |
$wsConfig.passwordReset
Returns the password reset settings.Properties of $wsConfig.passwordReset
| Property | Type | Description |
|---|---|---|
checkLoginID | bool | Whether the login ID is checked on reset. |
checkOldPassword | bool | Whether the old password is checked on reset. |
$wsConfig.directOrder
Returns the direct order settings (e.g. how many input lines are displayed).Properties of $wsConfig.directOrder
| Property | Type | Description |
|---|---|---|
initialNumber | int | Number of initially displayed lines. |
maximalNumber | int | Maximum number of lines. |
refreshedNumber | int | Number of newly loaded lines. |
itemNumberFields | array | Item number fields of the direct order. |
$wsConfig.emails
Returns the email configurations.$wsConfig.redirects
Returns the redirect configurations.Methods
No methods are available for$wsConfig.
Actions
No actions are available for$wsConfig.
Examples
Country select field
A select field with all configured countries. The value is the ISO-2 code.
Salutation select field
A select field with all configured salutations.
List payment methods
All configured payment methods with name and description.
Display the currency correctly
The amount is output with the currency symbol (e.g.
1,500.00 €).
Related links
- Configuration – where the values read here are maintained.
- Configuration via code – configuration directly in the template.
- $wsCheckout – determines, among other things, the shipping costs per shipping method.
- ISO 3166-1 code list – meaning of the country codes.
