← All modules

Magento 2 module

Widget Theme Copy

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.

Also known as: copy widgets to another theme, widgets missing after theme change, assign widgets to new theme

Magento assigns every widget to a theme. When a store switches to a new theme or a child theme, the widgets of the previous theme are no longer shown: CMS blocks in the footer, on the home page or in categories simply disappear, and they have to be assigned to the new theme one by one in the admin. This module copies all widgets of one theme to another with a single command.

Features

  • One command copies all widgets of a theme to another theme, with their store views, settings, sort order and page assignments, exactly as if they were saved for the new theme in the admin.
  • A dry run shows what would be copied without changing anything.
  • Widgets that the new theme already has are skipped, so the command can run more than once; on request they are replaced instead.
  • The caches for layouts, blocks and pages are cleaned afterwards; the widgets of the previous theme stay untouched.

Configuration

There are no settings. Run bin/magento widget:theme:copy --from Magento/luma --to Vendor/theme on the server, first with --dry-run, and ideally on a staging system before production.

Good to know

Useful together with Theme Luma Left and any other theme a store switches to. The module only adds the command; it changes nothing in the store until the command is run.

Installation

Install the module with Composer in your Magento root directory:

composer require infrangible/m2-widget-theme-copy

Then enable it and update the store as described in the installation guide. Composer installs the required modules listed on this page automatically.