What you described in the example looks like Swatches. This is also a configurable product, but the option for choosing the option does not look like a dropdown, but is similar to what you can see in your example (rectangle for selecting an option with text, picture or product color).
Out of the box, when choosing options, the images and the price will change.
More details can be found here: Magento\ConfigurableProduct\Block\Product\View\Type\Configurable::getJsonConfig()
.
By default, simple products within a configurable are Not visible individually
.
Therefore, if we open the URL of a simple product, we get a 404.
But out of the box in Magento 2 it is possible to preselect a simple product using parameters in the URL of a configurable product.
To preselect a simple product in a configurable product, the address of a simple product should look like this for example:
/mona-pullover-hoodlie.html#143=167&93=53
where
/mona-pullover-hoodlie.html
- configurable product URL,
143
, 93
- attributes IDs,
167
, 53
- option IDs.
You can create a Plugin (Interceptor) for Magento\ConfigurableProduct\Block\Product\View\Type\Configurable::getJsonConfig()
where you need to add missing OOTB SKUs and URLs (formed as in the example above) for each simple product.
Switching SKU and URL when selecting an option can be implemented in vendor/magento/module-swatches/view/base/web/js/swatch-renderer.js
.
I made VCT Product Info Switcher
and VCT Simple Product URL
modules that solves this problem.