Skip to main content
When a customer opens a product with dependent variants, no combination is chosen initially. You can instead preselect a combination so the product immediately appears in a meaningful configuration. A shirt then shows, for example, sleeve length 65 cm and size 42 right away. The customer can still change the selection. There are two ways to do this, differing in where the preselection is maintained.

Way 1: preselection in the product data

This preselection can be defined for simple products and for sets. Activation by WEBSALE is not required. Vorausgew Abh Var In the example above, after the corresponding definition, the selected shirt is shown by default with the preselected variants sleeve length = 65cm and size = 42.

Set the product data field

For simple products, pass this field:
For set products, a separate field is provided because several products are affected at the same time: The list follows a fixed structure:
  • as parameter-value pairs in URL format, without URL encoding
  • the variant index of the set parent product in the parameter depvar_index_setparent
  • the variant indices of the set sub-products in the parameters depvar_index_set_<running index of the set sub-product>
The parameter list therefore has exactly the same format as the output of the tag PR-SetLink. If you are unsure how a list should look, display this output for the set and take it from there. Reference: PR-SetLink
If you specify a preselection for the entire set on a set product, the preselections of the individual set sub-products are no longer taken into account. This also applies when your specification only concerns parts of the set.

Output the preselection in the template

Optionally, output the stored variant index on the product detail view, for example for verification.
Reference: PR-DefaultDepVarIndex

Activate the feature

The maintained fields only take effect once you enable the feature in the shop configuration shop.config in the <Basic> section. The parameter knows two values, and the order is intentional: first check in test mode, then go live.
With the value test, call the shop in test mode and check your products:
If the preselected combinations appear as desired, end test mode and set the parameter to yes.
Reference: Basic section

Way 2: preselection in the template

Instead of per product, the preselection can also be set in the template. The tag PR-PreSelectDepVariation() expects two pieces of information: the desired combination and the behavior if this combination does not exist. You specify the combination either via the variant name or via the variant index. For the case of unavailability, three behaviors are available: load the base product, load the closest combination, or load the first determined combination. In the following example, the product is available in several colors and should appear with “sapphire blue”. If this color is not available, the closest combination is loaded.
Activation by WEBSALE is not required here either.
Only product fields and their values can be given in the preselection. Other information, for example stock, is not possible as a criterion.
If the preselection does not take effect as expected, a status code helps with troubleshooting. The meaning of the individual codes is given in the tag description.
Reference: PR-PreSelectDepVariation()
  • Guide: Display dependent variants
  • Guide: Set products
  • Guide: Enable and disable the shop’s test modes