How to uninstall theme in magento 2

0
433
uninstall theme magento 2

This topic describes how to uninstall a theme in magento2

Prerequisites

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

Uninstall

Uninstall a manually added theme

  1. Remove the theme folder from app/design/frontend/<Vendor>/.
  2. Clear the content of var/view_preprocessed/
  3. Clear the content of pub/static/frontend/
  4. Open the Magento’s database, go to the theme the table then search and delete the theme row.
  5. Clear the cache with php bin/magento cache:flush.

Uninstall a theme install via composer

1. Edit  <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:

“require”: {

“<vendor>/<theme-name>”: “<version>”
},
3.  Run: composer update

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

magento theme:uninstall [--backup-code] [-c|--clear-static-content] {theme path} ... {theme path}

where

  • {theme path} is the relative path to the theme, starting with the area name. For example, the path to the Blank theme supplied with Magento 2 is frontend/Magento/blank.
  • --backup-code backs up the Magento 2 codebase as discussed in the paragraphs that follow.
  • --clear-static-content cleans generated static view files, which is necessary to cause static view files to display properly.