Search by

infrangible / m2-widget-theme-copy

infrangible

Console command for Magento 2 that copies the widgets of one theme to another theme, for example after switching the store to a new or child theme.

Package info

github.com/infrangible-dev/m2-widget-theme-copy

Homepage

Type:magento2-module

pkg:composer/infrangible/m2-widget-theme-copy

Statistics

Installs: 0

Dependents: 0

Suggesters: 1

Stars: 0

Open Issues: 0

1.0.0 2026-11-27 14:41 UTC

This package is auto-updated.

Last update: 2026-11-27 15:09:35 UTC


README

Magento assigns every widget (Content > Widgets) to a theme. When a store switches to another theme, for example a child theme or a new theme, the widgets of the previous theme are not shown anymore: CMS blocks in the footer, on the home page or in categories disappear until they are assigned to the new theme one by one. This module adds a console command that copies all widgets of one theme to another theme in one step.

Usage

bin/magento widget:theme:copy --from Magento/luma --to Vendor/theme
  • --from and --to: the themes as shown in Content > Design > Themes, for example Magento/luma (frontend/Magento/luma works too).
  • --dry-run: lists what would be copied, without changing anything.
  • --replace: widgets that the target theme already has with the same type and title are replaced by a new copy. By default they are skipped, so the command can run more than once without creating duplicates.

Every widget is copied with its title, store views, parameters, sort order and page assignments (all pages, specific pages or categories, page layouts), exactly as if it was saved for the other theme in the admin. Afterwards the caches for layouts, blocks and pages are cleaned. The widgets of the source theme are kept.

Run the command after installing the new theme (setup:upgrade), before or after selecting it in Content > Design > Configuration; try it with --dry-run first, and on a staging system before production.

Requirements

  • Magento Open Source or Adobe Commerce 2.4.6 or newer
  • PHP 8.1 or newer

Installation

composer require infrangible/m2-widget-theme-copy
bin/magento module:enable Infrangible_WidgetThemeCopy
bin/magento setup:upgrade

In production mode, also run bin/magento setup:di:compile.

License

Infrangible Widget Theme Copy is licensed under the MIT License - see the LICENSE file for details.