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.
- View the
themetable within your Magento 2 database and check the
- 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
typecolumn. 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.
- If you see your theme value set as 1, change the value to 0
- Once changed in your database use the Magento 2 CLI and compile
php bin/magento setup:di:compile
- You can also
php bin/magento cache:cleanfor good measure.