Skip to main content
Instead of using select lists, the customer can also choose dependent variants via links. All values are then visible at the same time and a single click is enough. This requires a manageable quantity, up to a maximum of 50 dependent variants. The display is built into the single-product template. It consists of two parts, both of which are required: the links themselves and the hidden input fields in the product form. For each dependent variant, create a loop that outputs its values along with a link. The surrounding bracket PR-DepVariationName1 ensures the block only appears when this variant exists for the current product. Within the loop, PR-DepVariationOptionSelected1 highlights the value that has already been chosen. Without this marker, the customer would not see where they currently are.
For each additional dependent variant, repeat the block with the next higher number. Up to 200 are possible. In the example, the highlighting of the selected value is done via a CSS class. This is preferable to a style attribute set directly, because you maintain the appearance in one place in the stylesheet rather than in every variant block.

Hidden input fields in the product form

Inside the product form, additionally place the tag PR-PrintHiddenDepVariations.
This step is not optional. When selecting via links, the chosen variant is only in the URL, not in the form. Without the hidden input fields, the shop would not know which variant was meant when the form is submitted, and a product selected via a link could not be added to the shopping cart, the wish list, or the product comparison.

Tags

  • Guide: Display variants
  • Guide: Reload dependent variants via AJAX
  • Guide: Display dependent variants as select lists
  • Guide: Display dependent variants as a table