$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
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 thecurrency filter (see Format currency).
Properties of $wsConfig.currency
$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
$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
$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 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
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 thegroup field of the respective shipping method (see Properties of a shipping method).
Properties of a group
$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
$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 (e.g. how many input lines are displayed).Properties of $wsConfig.directOrder
$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.
