Hi,
There are several things here:
- First, by default related products can't be configured per variant, only at the main product level.
- Second, when you change the selection of the variant on the frontend, the related products area is not refreshed.
- Third, the related products area under the product page is a listing of products, not a listing of variants. It is not made to be able to display variants.
Basically, the system is not meant to do what you want here and thus it won't be easy. If it were me, I would develop a custom plugin for this. It would:
- add an interface to select products on the variant edit form. This could potentially by made with a custom text field where you would just enter the code of the related variants separated with a comma.
- using the onHikashopBeforeDisplayView event (
www.hikashop.com/support/documentation/6...hopBeforeDisplayView
), check that we're on the frontend product details page, load the data of the variants of all the variants of the current product, return the HTML of all of them with only the default variant's listing visible by default + JS code implementing hkContentChanged (
www.hikashop.com/support/documentation/6...tml#hkContentChanged
) to change the visibility of the variants listing based on the selected variant.
With this, you have no custom hack, just a clean plugin implementing the events of HikaShop, so no surprises with updates.
However, it does require some development, several hundreds of lines of PHP to make that plugin.
If you have a proper setup, with a Claude Code or Codex, the AI can base itself on what I wrote here, plus the codebase of HikaShop and its plugins, to implement that plugin.