ecomhouse / defaultvariant
Default variant selection for configurable products in Magento 2 by ecomhouse
Package info
github.com/ecomhouse/defaultvariant
Language:JavaScript
Type:magento2-module
pkg:composer/ecomhouse/defaultvariant
Requires
- php: >=8.2
This package is auto-updated.
Last update: 2026-08-05 14:23:52 UTC
README
ecomhouse/defaultvariant lets a merchant mark one child product of a configurable product as
its default variant. It adds a default_variant product attribute plus an admin control in
the configurable product's Configurations matrix — a Choose Default Variant action on each
variant row — that stores the chosen child's ID on the parent. The attribute is exposed to the
storefront (product listing and product view) so a theme or integration can read it and open the
product on that variation.
Polish usage guide: docs/jak-uzywac.md.
Requirements
| Requirement | Version |
|---|---|
| Magento Open Source | 2.4.x |
| PHP | >= 8.2 |
Magento_ConfigurableProduct |
core |
Magento_Catalog, Magento_Eav |
core |
No ecomhouse/base dependency — this module ships no admin config section and hangs nothing off
the ecomhouse menu.
Installation
Composer
composer require ecomhouse/defaultvariant bin/magento module:enable EcomHouse_DefaultVariant bin/magento setup:upgrade bin/magento setup:static-content:deploy -f bin/magento cache:flush
Manual
cd app/code mkdir -p EcomHouse/DefaultVariant # Extract module files into the directory created above bin/magento module:enable EcomHouse_DefaultVariant bin/magento setup:upgrade bin/magento cache:flush
Verify
bin/magento module:status EcomHouse_DefaultVariant
Expected: Module is enabled. setup:upgrade also creates a Default Variant Id
(default_variant) text attribute on the product entity, applied to configurable products
(Stores > Attributes > Product).
Configuration
There is no Stores > Configuration section. The module works entirely from the product edit
page: open a configurable product, and each row of the Configurations matrix gains a
Choose Default Variant item in its Select action menu. Picking it marks that variant as the
default (the chosen row is outlined in green) and saves its ID into the default_variant
attribute on save.
Full walkthrough: docs/how-to-use.md. Polish version: docs/jak-uzywac.md.
Uninstalling
bin/magento module:disable EcomHouse_DefaultVariant composer remove ecomhouse/defaultvariant bin/magento setup:upgrade bin/magento cache:flush
Uninstalling does not remove the default_variant EAV attribute — remove it manually at
Stores > Attributes > Product first if you want a clean removal.
Support
- Email: opensource@ecom.house
- Website: https://ecom.house/
- Changelog: CHANGELOG.md
- License: OSL-3.0