Fixing Magento 2 missing theme and/or not being applied to website/store

At Linchpin we work on a lot of different projects that are in varying state of development. This presents challenges when switching between branches of a project’s .git repo that may not have your theme merge into it.

Additionally, this issue can come up if you move your theme directory or rename the theme directory.

If you ever come across this situation with your Magento 2 theme and the theme is no longer visible on the front end of your website; there is a simple solution.

  1. View the theme table within your Magento 2 database and check the type column.
    • The type column defines if the theme is “physical”  (IE you have files present within the directory for the theme app/design/Namespace/themename ). This will be indicated by a value of 0 (zero) in most theme rows.
    • You may also see your theme as “virtual” indicated by a value of 1 (one) in the type column. This typically means that you have created a child theme within the admin and there aren’t any files associated with the theme. If Magento detects a change and can not find your files, it will automatically update the database value of your theme to be “virtual”. Since there are not configurations for the theme in the database as a “virtual” theme. This will result in your theme not being applied at all.
  2. If you see your theme value set as 1, change the value to 0
  3. Once changed in your database use the Magento 2 CLI and compile php bin/magento setup:di:compile
  4. You can also php bin/magento cache:clean for good measure.

Aaron Ware

Over the past decade Aaron Ware has worked with leading brands, start-ups and everyone in between to develop innovative, highly interactive, feature-rich websites and online apps.

| @aaronware