Home » Ecommerce News » Most common issues in Magento 2 and how to fix them?

Most common issues in Magento 2 and how to fix them?

Solved How To Fix Most Common Issues in Magento 2

Magento 2 version has released along with the hope and excitement of all ecommerce platform community. However, something thing new will always go with challenges, of course, there are both sides for everything. In this post, we will spend some time to discuss about some of the most common issues of Magento 2 as well as the solutions for them.

From the first time, they might be small and simple issue, but if you do not solve they properly, they can become bigger for you. Here is the list for you:

  1. Installing sample data after Magento 2 setup: First, download sample data: sudo php bin/magento sampledata:deploy and then install sample data: sudo php bin/magento setup:upgrade
  2. Clearing theme/CSS cache: To clear the cache for themes or CSS, run the following commands:

sudo php bin/magento cache:flush

sudo php bin/magento cache:clean

  1. Re-indexing: In Magento 2, one or more indexers are invalid. So, you need to make sure that your Magento cron job is running. For re-indexing your store, run the command php bin\magento indexer:reindex in your CLI. If you want to re-index only one indexer then write the command php bin\magento indexer:reindex indexer_name where indexer_name can be found by typing command php bin\magento indexer:info
  2. Removing block from layout: In more recent versions of Magento 2, the remove method is

<referenceBlock name=”block_name” remove=”true”/>

  1. Setting Developer Mode: The developer mode can be set up from the CLI bin/magento deploy:mode:set developer
  2. Getting Magento 2 base URL: If you want to get Base url ,then you can try below code:


Also use:




For getting media base URL:


  1. Checking module installation: To check the enabled or disabled module list use below command.

magento module:enable [-c|–clear-static-content] [-f|–force] [–all] <module-list>

magento module:disable [-c|–clear-static-content] [-f|–force] [–all] <module-list>

  1. Using jQuery library: If you are adding your custom js library other the jQuery then you need to include the js code inside require function like:

require([‘jquery’, ‘jquery/ui’], function($){

//your js code here


  1. Setting backend session timeout: You can set the backend session timeout from the admin panel by Stores->Settings->Configuration->Advanced->Admin->Security->Admin Session Lifetime (seconds)
  2. 404 error for scripts and CSS: When not in the production mode, Magento 2 will try to create symlinks for some static resources. You can change that behavior by doing the following.
  • Open up app/etc/di.xml and find the virtualType name=”developerMaterialization” In that section you’ll find an item name=”view_preprocessed” that needs to be modified or deleted. You can modify it by changing the contents from Magento\Framework\App\View\Asset\MaterializationStrategy\Symlink to Magento\Framework\App\View\Asset\MaterializationStrategy\Copy
  • Delete the files under pub/static to get rid of any existing symlinks. You may want to be careful not to delete the .htaccess


You want to eliminate all those issues but you are not a master of programming, the best idea is choosing Magento 2 extensions from reputation providers. One of them is Cmsmart Marketplace, if you have any problem, you can create ticket and they will solve for you properly.

Check Also

magento 2 marketplace

Must have Magento 2 extensions integrated in Magento 2 marketplace package

Unlike the traditional Ecommerce website model, marketplace transfer the burden of maintaining inventories, logistics, images, …