|
1 |
| -Magento_ConfigurableProduct module introduces new product type in the Magento application called Configurable Product. |
| 1 | +# Magento_ConfigurableProduct module |
| 2 | + |
| 3 | +The Magento_ConfigurableProduct module introduces new product type in the Magento application called Configurable Product. |
2 | 4 | This module is designed to extend existing functionality of Magento_Catalog module by adding new product type.
|
3 | 5 |
|
4 | 6 | Configurable Products let the customers select the variant they desire by choosing options.
|
5 | 7 | For example, store owner sells t-shirts in two colors and three sizes.
|
| 8 | + |
| 9 | +## Structure |
| 10 | + |
| 11 | +`ConfigurableProduct/` - the directory that declares ConfigurableProduct metadata used by the module. |
| 12 | + |
| 13 | +For information about a typical file structure of a module in Magento 2, see [Module file structure](https://devdocs.magento.com/guides/v2.4/extension-dev-guide/build/module-file-structure.html#module-file-structure). |
| 14 | + |
| 15 | +## Extensibility |
| 16 | + |
| 17 | +Extension developers can interact with the Magento_ConfigurableProduct module. For more information about the Magento extension mechanism, see [Magento plug-ins](https://devdocs.magento.com/guides/v2.4/extension-dev-guide/plugins.html). |
| 18 | + |
| 19 | +[The Magento dependency injection mechanism](https://devdocs.magento.com/guides/v2.4/extension-dev-guide/depend-inj.html) enables you to override the functionality of the Magento_ConfigurableProduct module. |
| 20 | + |
| 21 | +## Additional information |
| 22 | + |
| 23 | +### Configurable variables through the theme view.xml |
| 24 | + |
| 25 | +Modify the value of the `gallery_switch_strategy` variable in the theme view.xml file to configure how gallery images should be updated when a user switches between product configurations. |
| 26 | + |
| 27 | +Learn how to [configure variables](https://devdocs.magento.com/guides/v2.4/frontend-dev-guide/themes/theme-images.html#view_xml_vars) in the view.xml file. |
| 28 | + |
| 29 | +There are two available values for the `gallery_switch_strategy` variable: |
| 30 | + |
| 31 | +Value | Description |
| 32 | +--- | --- |
| 33 | +`replace` | In replace mode, images of the parent configurable product will be replaced by the simple product images upon a configuration change |
| 34 | +`prepend` | In prepend mode, the simple product images will be added in front of the parent configurable product upon a configuration change |
| 35 | + |
| 36 | +If the `gallery_switch_strategy` variable is not defined, the default value `replace` will be used. |
| 37 | + |
| 38 | +For example, adding these lines of code to the theme view.xml file will set the gallery behavior to `replace` mode. |
| 39 | + |
| 40 | +```xml |
| 41 | +<vars module="Magento_ConfigurableProduct"> |
| 42 | + <var name="gallery_switch_strategy">replace</var> |
| 43 | +</vars> |
| 44 | +``` |
0 commit comments