$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
ƒ() denotes a function.
Variables and methods overview
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.$wsSubshop.currentTime
Returns the current timestamp in ISO 8601 format (e.g.,2026-06-26T09:18:59.000Z). Format this value with the global function dateFmt() into a readable date or time.
$wsSubshop.timeZone
Returns the time zone configured in the shop (e.g.,Europe/Berlin). This is the time zone that dateFmt() uses when no separate time zone is specified during formatting.
$wsSubshop.language
Returns a map with language information of the current subshop.$wsSubshop.language.isoCode
Returns the ISO language code of the current subshop.$wsSubshop.language.name
Returns the name of the language of the current subshop.$wsSubshop.subshops
Returns a list of all available subshop IDs. Useful for creating a language switcher or country selector.Methods
$wsSubshop.subshopUrl()
Returns the URL to the home page of the specified subshop. The URL automatically takes into account the domain of the target subshop as well as the protocol of the current request (http or https).
Signature$wsSubshop.subshopUrl(subshopId, params)
Return valuestring - URL of the specified subshop. null if the subshop ID is empty or no subshop with this ID exists.
Parameters
Example that outputs the URL of a subshop.
params is transferring the basket when switching subshops, see Transferring the basket when switching subshops.
Actions
No actions are available for$wsSubshop.
Examples
Set HTML lang attribute
Display current language
Output the current year in the footer
CombinescurrentTime with dateFmt, for example to keep a copyright line always up to date.
Transferring the basket when switching subshops
Each subshop has its own session and therefore also its own basket. These baskets remain permanently separate. They are not synchronised with each other, and an order always belongs to exactly the subshop in which the order process was completed. When a customer switches to another subshop, they therefore initially start there with an empty basket. When switching, however, the positions can be transferred once. To do this, append the query parametertransfer with the ID of the current session to the target URL. The target subshop then reads the basket of the specified session and creates the positions anew in its own basket. This does not create a shared basket from both baskets, but a copy of the basket at the time of the switch.
Afterwards, both baskets evolve independently of each other. Later changes in the source subshop no longer reach the target subshop. There is no configuration node for this; the feature depends solely on this parameter.
Usage in the template
What is transferred
The transfer is a copy operation. The basket of the source session remains unchanged. Only the basket positions are transferred. Login, addresses, vouchers, and the state of the checkout process are not transferred. The positions are not simply copied in the target subshop, but rebuilt:- The product is first looked up via the product ID. If it is not found this way, the shop searches via the item number instead. This search only considers products that are active in the target subshop.
- If a variant is specified, the shop checks whether it exists on the target product.
- Set products are completely rebuilt, i.e. main position and sub-positions, checked against the set definition in the target subshop.
- The quantity is checked against the maximum quantity allowed in the target subshop.
- Prices and taxes are recalculated in the target subshop. A price or currency difference between the subshops therefore takes effect immediately.
- The stock is reserved anew in the target subshop.
Positions that cannot be resolved in the target subshop are skipped. The remaining positions are still transferred. The basket in the target subshop may therefore contain fewer positions after the transfer than originally. Each skipped case is logged, see Logging.
- Automatic add-ons from
basket.autobasket. These are created anew in the target subshop based on the configuration valid there. - Identical positions that already exist. If the target basket already contains the same position with the same quantity, it is not created a second time. If the quantity differs, the position is created additionally.
Requirements
- The product must exist and be orderable in the target subshop.
- For set products, the set definition in the target subshop must match the transferred composition.
- Sufficient stock must be reservable for the position in the target subshop.
The value of
transfer is a session ID. Anyone who knows it can read the associated basket. Therefore, use the parameter exclusively for links within your own shop and do not pass the session ID on to third parties, for example via external tracking parameters or redirects to external domains.Logging
Skipped positions appear in the log manager with the following codes:
If the search via the item number fails for technical reasons, the codes
basket.searchProductIdByNumberNoDescriptor, basket.searchProductIdByNumberNoActiveProperty, or basket.searchProductIdByNumberSearchFailed additionally appear.
If the session specified in transfer is unknown or can no longer be read, nothing happens and nothing is logged. In this case, first check whether the session ID passed is still valid.
Difference from cookie and account basket
The cookie basket (cookieBasketActive) and the account basket (accountBasketActive) from basket.basket are no substitute for the transfer. They preserve the basket across sessions and devices, not across subshops. Since subshops usually run under their own domains, the basket cookie is not available in the other subshop.
Related links
- general - General shop settings
- basket - Basket - configuration of the basket, add-ons and maximum quantities.
- $wsSession - session ID used by the basket transfer.
- Functions - global functions such as
dateFmt,isoToUnix, andunixToIsofor processing timestamps.
