C O D I T R O N

Technologies

How To Install a Theme in Magento 2

By, Sanyogita Salunkhe
1st September 2022

What are the themes?

A theme is the building block of the Magento Application which provides the functionality of how the entire website looks and is designed. Magento theme is a collection of static files such as CSS, fonts, images and JavaScript.

Magento 2 allows one or more themes to be installed for different stores or websites within the project. Let’s see how to install a theme in Magento 2.

Theme can be installed using the following ways:

    1)Install manually

    2)Install using composer

Install a theme manually:

1)Unarchive the theme.

Unarchive the folder of the theme. After unarchiving you will get the two folder directories: app and pub. Sometimes you only need the <vendor name>/<theme> folder so just copy that folder.  And the theme-related all files are in the <theme> folder.

2)Upload the theme to the server.

Go to the root directory of the Magento 2 server. Upload the app and pub folder into the root directory. If your copying <vendor name>/<theme> folder then go to <magento_root_directory>/app/design/frontend folder and paste this directory here.

3)Run the commands.

Run the following commands in the Magento root directory:

  • php bin/magento setup: upgrade – to upgrade the setup
  • php bin/magento setup:static-content:deploy- to write static files in Magento  files

3)Apply the new theme:

1. Log in to the admin panel of the Magento store and go to the content>Design>Configuration.

2. Click on the Edit action.

3. Select the uploaded theme from the Applied theme drop-down menu and click on the Save Configuration button.

Manually installed themes are stored in the app/design/ directory.

Install a theme using the composer package:

If a new theme is conferred as a composer package, you need to install it using composer.  

1)Select the theme from the provider whose themes support the composer.

 2)Navigate to the Magento root directory and run the following command:

  • composer require <vendor>/<name>:<version>
  • composer update

Wait until dependencies are updated from the theme.

3)To apply the theme:

1. Log in to the admin panel of the Magento store and go to the content>Design>Configuration.

2. Click on the Edit action.

3. Select the uploaded theme from the Applied theme drop-down menu and click on the Save Configuration button.

When you have installed a theme using the composer package then themes are stored in the Vendor directory.  Composer-based installed themes are loaded from external sources so they cannot be changed or modified directly while in contrast, local themes are components of the project source code forasmuch as can be modified directly.

Conclusion:

Theme installation in Magento2 is as simple as Magento 1. I hope that after reading this blog you can easily follow the steps mentioned above and successfully install a theme on your Magento 2 setup. If you have any doubts or if you face any errors, use the comment section below to let us know and we will help you with it.

Thank You!

Coditron Technologies

Contact Us

Address

Corporate Office : Greens Center, Thergaon Pune 411033

Operation Office: USA: PO Box # 582973 ElkGrove CA 95758