Magento 2.1.18 is the final 2.1.x release. After June 2019, Magento 2.1.x will no longer receive security patches, quality fixes, or documentation updates.
To maintain your site's performance, security, and PCI compliance, upgrade to the latest version of Magento.

Uninstall a storefront theme

What’s in this topic

This topic describes how to uninstall a storefront theme in Magento 2.

The way a theme should be uninstalled is defined by two factors:

The following sections describe the flow for uninstalling themes in each case.

Prerequisites

  1. Set your Magento application to the developer or default mode.
  2. Make sure that the theme is not applied on the storefront. To do this, in the Admin panel navigate to Content > Design > Configuration and make sure that your custom theme is not applied for any store view.
  3. Make sure that the theme is not defined as a parent for any registered theme. To do this, in the Admin panel, navigate to Content > Design > Themes. Make sure that your theme is not mentioned in the Parent Theme column. If it is mentioned, you need to uninstall the child theme first.

Uninstall a manually added theme

If you created or manually installed the theme, it does not matter how you installed Magento.

To uninstall a manually added theme:

  1. Navigate to the vendor directory where the theme was installed. This directory should be: <Magento root dir>/app/design/frontend/<VendorName>.
  2. Remove the theme directory.
  3. Remove the theme record from database. If you are using MySQL, run the following command to do this:
1
mysql -u <user> -p -e "delete from <dbname>.theme where theme_path ='<Vendor>/<theme>' AND area ='frontend' limit 1"

Where:

  • <user>: your Magento database username
  • <dbname>: your Magento database name
  • <Vendor>/<theme>: relative path to the theme directory

Uninstall a theme package

The flow for uninstalling a theme that is Composer package is different, depending on the way your Magento instance was installed.

Uninstall a theme package if Magento was installed using Composer

If both the theme and the Magento instance were installed using Composer, you can use a special CLI command. Follow the instructions from the Uninstall themes Composer package topic.

Uninstall a theme package if Magento was installed by cloning the repository

To uninstall a theme Composer package if your Magento instance was installed by cloning the Git repository, you can also uninstall it using a CLI command. However, you must first remove it from the list of dependencies.

Take the following steps:

  1. Open the <Magento root dir>/composer.json file.
  2. Find a line with a reference to theme package and delete it. The reference would look like following:

    1
    2
    3
    4
    
    "require": {
     ...
        "<vendor>/<theme-name>": "<version>"
    },
    
  3. To update the project dependencies, run:

    1
    
     composer update
    
  4. Use the magento theme:uninstall CLI command as described in the Uninstall themes Composer package topic.

You can use the Composer remove command to remove the dependency, but in that case you will also to delete theme record from database manually.

Uninstall a theme extension

If the theme was installed as an extension, you can uninstall it using one of the following flows:

  • the same way as theme Composer packages are uninstalled, see the Uninstall a theme package section for details.
  • using the Component Manager.

To uninstall a theme extension using the Component Manager:

  1. In the Magento Admin Panel, navigate to System > Web Setup Wizard > Component Manager.
  2. In the Actions column, click Select > Uninstall in the theme record. See the following image for illustration.

extension_manager_uninstall_theme

Updated