Shopware 6 - Tips, tricks and how to's

How to activate and deactivate plugins efficiently for debugging

So you have encountered an error on your Shopware 6 store and you are not sure, if it is caused by your plugin, a third party plugin or if it is caused by something else. The first step to debug this would be to turn off the plugins and see, if the problem persists. Of course you could go to the Plugin manager in Administration and disable the plugins one by one. But that could take ages, especially when you have a lot of plugins in your store!

What you need, is a way to activate and deactivate the plugins quickly and in groups. Fortunately, you can do this using the command line. It is much faster and you can also do it in a batch. So here are the commands..

The commands for working with plugins

This command gets you a list of plugins, that are present in your Shopware 6 store and shows you some additional information about them, like their version or their status:

These commands allow you to activate or deactivate one or more plugins:

If you want to activate or deactivate more of them in one go, then just write their names one after another. Do not be afraid to mix activated and dectivated here. The system will automatically skip those plugins, that already have the requested status. The names of the plugins, that the command expects, are the ones, that are in the first column of the plugin:list command and also in the Shopware 6 database in table plugin and column name.

Tips for getting the plugin names efficiently

If you have one or two plugins, that you need to activate and deactivate quickly for debugging, then you will be probably fine with just writing their names. In my experience however, the number of plugins can be in dozens. In that case, it pays off to prepare the commands outside of the command line interface and copy them there. And for that, you need to get the names of the right plugins and have them in one line, divided by spaces.

The plugin:list command is not really a table, so it is not very convenient to copy the plugin names from it. A better option here would be the table plugin in your store’s database. If you have named your plugins properly, especially in the composer.json files, it is pretty easy to sort and select them. If you use some MySQL client software like Navicat, you can easily open the table in a GUI, sort it and copy the plugin names, that you want. In any case, you can get the names of your plugins using SQL queries like this:

Once you have the list from the table, you just have to put it to one line, divided by spaces. This can be done manually, or using an online tool like https://www.convertcsv.com/transpose-csv.htm. Here is a quick guide:

  • Paste your plugin name list to the input text area:
  • Go to step 3 and in Output field separator, click on Other-Choose and put in a space
  • click on Transpose CSV and copy the result

And that’s it. Now you can paste the result to the command line, just after the command and finally press the Enter to run it.

Since you will be doing this more often, I recommend saving the complete command with parameters for future use. It is also quite handy to have it ready in your notepad during your debugging session, so that you can add and remove plugins conveniently, as you search for the problematic one. Happy debugging. 🙂