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
JSON output
Variables overview

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

$wsConfig.currency

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

Properties of $wsConfig.currency

$wsConfig.salutation

Returns the configured salutations. The actual list is found under salutation.codeList. Use it, for example, to populate a salutation select field.

Properties of an entry in salutation.codeList

$wsConfig.title

Returns the configured titles. The list is found under title.codeList. The structure is analogous to salutation.

Properties of an entry in title.codeList

$wsConfig.payments

Returns the configured payment methods. Use it to display the available payment methods.

Properties of a payment method

displayInfo is only populated if the displayedPaymentTypes parameter has been configured for the payment method. Each entry contains name, description and image.

Additional fields of a payment method (fields)

fields contains the additional fields assigned to the payment method under additionalFields. Only fields whose display conditions are currently met are listed. The entries are saved with the CheckoutSetPaymentFields action, where you can also find a complete form example.

$wsConfig.shippingMethods

Returns the configured shipping methods.

Properties of a shipping method

The shipping costs are not part of the configuration. They depend on the basket and are determined via $wsCheckout.getShippingCost(shippingMethodId).

$wsConfig.shippingMethodGroups

Returns the configured shipping method groups. A group can bundle several shipping methods (e.g. by provider or delivery type). Which group a shipping method is assigned to is indicated in the group field of the respective shipping method (see Properties of a shipping method).

Properties of a group

$wsConfig.listElements

Returns the configured address lists for forms, for example private / company / parcel station. Use them to populate select fields in address forms. Each list is accessible under its configured name. The path it sits under is determined by the list’s addressType parameter:
The key is the list’s name, not its dataId. If the two are maintained differently, the list is accessible in the template exclusively via name. The dataId, by contrast, is referenced in the field validation.

Properties of an entry in listElements

values only contains options with permitted values. Options whose value contains special characters or whose name is empty are skipped when the page is built and are missing here without any error message – see general.addressListElements. If an expected option is missing from the form, check its value first.
Example that outputs the billing address list billAddressType as a select field. The value already saved for the address being edited ($myAddress) is preselected, otherwise the configured defaultValue.
Result
A select field with all configured options of the list. When editing an existing address, the saved value is preselected; when creating a new address, the default value.
In the example, $myAddress stands for the address being edited in the form – for instance an address from $wsAccount.addresses or an address loaded via $wsAccount.loadAddress(). When creating a new address, the variable is empty and the else branch applies.
If you want to output all lists of an address type dynamically, iterate over the map. Use a separate field name per list so the values remain distinguishable on submit.

$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

$wsConfig.passwordReset

Returns the password reset settings.

Properties of $wsConfig.passwordReset

$wsConfig.directOrder

Returns the direct order settings from the checkout.directOrder configuration, for example how many input lines are displayed.

Properties of $wsConfig.directOrder

Properties of an entry in itemNumberFields

The itemNumberChecks function is not available to the template because the checks run on the server. The fields and saveCountInSession properties are not part of $wsConfig.directOrder either, even though they belong to the checkout.directOrder configuration.

$wsConfig.inserts

Returns the settings for insert codes. In particular, use enabled to only show output related to insert codes when the feature is active in the shop.

Properties of $wsConfig.inserts

$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

Result
A select field with all configured countries. The value is the ISO-2 code.

Salutation select field

Result
A select field with all configured salutations.

List payment methods

Result
All configured payment methods with name and description.

Display the currency correctly

Result
The amount is output with the currency symbol (e.g. 1,500.00 €).