2

I need to disable all commerce modules from the Commerce Kickstart distribution. I've done this before using the drupal backend admin/modules and have no problem at all but it took me around 4hs because of the modules dependencies.

This time I would like to do it using Drush.

How can I do this?

I tried with drush dis -y commerce but I get a lot of error/warning lines (not sure if it worths to post them here...) and get the site broken.

  • 1
    Is there a particular reason you're doing this? Generally speaking disabling all of the modules in a distribution isn't recommended since the entire distribution is based on all of those modules... – nvahalik Feb 3 '16 at 13:57
  • 1
    @nvahalik yes there is. It was an e-commerce site and now this site is just a much simpler site (no e-commerce). As we all know, the Kickstart distribution is very heavy distribution (bad performance) and I see no point in keeping enabled all these module. – JPashs Feb 3 '16 at 14:30
  • You'll have more luck rebuilding the site, to be honest. Drupal 7 isn't built to have 80% of it uninstalled after a while. Especially Kickstart. – Bojan Zivanovic Feb 9 '16 at 15:27
2

Note that by disabling all of the Kickstart specific modules (which is practically required to uninstall Commerce due to dependencies) may cause your site to become unusable. If you're using the image rotator or the Kickstart specific content types things could get really crazy. You've been warned. Go slowly.

I know you want to know how to do it in drush, but using the UI will likely be easier given the amount of time it will take to do this:

  1. Uninstall the Kickstart specific modules. These will be all of the modules whose Package is Commerce Kickstart. There should be 18 of these. Disable one or two at a time. You have to do these first.
  2. Once those are done, then you'll need to go through and disable all of the Commerce Contrib modules. These would be modules found under Commerce (Contrib), Commerce (whatever), etc.
  3. Once those are done, then you should be able to disable the Commerce core modules.
1

If you try to disable too many modules at once, especially modules that have interdependencies, weird stuff can happen.

One way to do this is to go to the modules page, look at what commerce modules you can uncheck, and then make a list of those. Then write them in a list. Then go back to the page and do it again, and again, and again until you disable all the modules you wanted.

Then take your lists and write a drush command like this:

drush dis commerce_product_ui other_modules_in_set_1 -y; drush dis module_in_set_2 -y; drush dis module_in_set_3 -y

You can set this to a bash alias then to do it quickly and easily in the future. Ugly and untested but it will probably work.

1
  1. It's not recommended to disable commerce after installing

  2. It's really not recommended to try to uninstall commerce after installing

  3. Recommended - The easiest way to do it with kickstart would be simply using the commerce kickstart profile, and then not installing the kickstart profile. Then you're turning on modules instead of trying to turn them off.


If you can map the dependencies, then going from least dependent to most dependent, you could disable the commerce modules using drush. I would start with all the features, then move on to commerce_x modules that aren't core, then on to core modules.

drush pm-disable least_dependent // most likely features

drush pm-disable moderately_dependent // most likely commerce_x contrib

drush pm-disable most_dependent // most likely commerce_x core modules

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.