Replies: 2 comments
-
|
Hi @mgambella Thank you for the suggestion. The reasons you have stated were the main reasons why we started exploring adding a full variants view to Commerce. There were a few choices and decisions as to why this was never fully fleshed out. We are going to re-evaluate this to see if it is something that we can bring to a future version. For now if you would like to add the variants to the Commerce sub nav you can do it with the following code: use Craft;
use craft\base\Event;
use craft\events\RegisterCpNavItemsEvent;
use craft\web\twig\variables\Cp;
//...
Event::on(Cp::class, Cp::EVENT_REGISTER_CP_NAV_ITEMS, function(RegisterCpNavItemsEvent $event) {
foreach ($event->navItems as &$navItem) {
if ($navItem['url'] !== 'commerce') {
continue;
}
$variantsNavItem = [
'label' => Craft::t('commerce', 'Variants'),
'url' => 'commerce/variants',
];
$subNav = $navItem['subnav'] ?? [];
$keys = array_keys($subNav);
$pos = array_search('products', $keys, true);
if ($pos !== false) {
$before = array_slice($subNav, 0, $pos + 1, true);
$after = array_slice($subNav, $pos + 1, null, true);
$subNav = $before + ['variants' => $variantsNavItem] + $after;
} else {
$subNav['variants'] = $variantsNavItem;
}
$navItem['subnav'] = $subNav;
}
});Please view this with the caveat that things should work but are not completely tested due to it not being a fully fledged core feature. Hope this helps, we will post further updates as to when/if this feature will be implemented. Thanks! |
Beta Was this translation helpful? Give feedback.
-
|
This is great news! thanks for taking this in consideration again! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Description:
While working on product management, I discovered a hidden but incredibly useful feature that significantly improved my workflow: the Product Variants index page with bulk editing capabilities.
Current Behavior:
The default product management interface (/admin/commerce/products/products?source=productType%3A...) displays products with variants accessible only through a right-side panel. This makes bulk editing variants cumbersome and time-consuming, especially when working with multiple variants across different products.
Discovery:
By manually changing the URL from
/admin/commerce/products/...to/admin/commerce/variants/..., I discovered a dedicated Product Variants index page that includes:This view saved me hours of work, but I only found it by accident through URL manipulation.
Expected Behavior:
The Product Variants index should be easily discoverable and accessible through the main navigation. Specifically:
Why This Matters:
For shops with products that have multiple variants (different sizes, colors, materials, etc.), being able to view and edit all variants in a unified index with bulk operations is essential for efficient product management. Having this feature hidden behind manual URL manipulation means most users will never discover this time-saving functionality.
Environment:
Craft Commerce version: 5.5.0
Craft CMS version: 5.8.20
Additional Context:
The feature already exists and works perfectly - it just needs to be surfaced in the UI for discoverability.
Beta Was this translation helpful? Give feedback.
All reactions