Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

When activating Classic Commerce, deactivate WooCommerce #136

Closed
nylen opened this issue Nov 26, 2019 · 17 comments
Closed

When activating Classic Commerce, deactivate WooCommerce #136

nylen opened this issue Nov 26, 2019 · 17 comments
Milestone

Comments

@nylen
Copy link
Contributor

nylen commented Nov 26, 2019

As described in the title: When CC is activated, WooCommerce should be deactivated automatically.

This should only be done if the woocommerce folder actually contains WooCommerce, not the compatibility plugin described in #131 (comment).

@nylen
Copy link
Contributor Author

nylen commented Nov 26, 2019

I forgot to explain why: this will prevent fatal errors when both Woo and CC are activated.

@zulfgani
Copy link
Contributor

So the task would be for CC to firstly deactivated WC, delete it and then install and activate the compatibility plugin?

I ask since the compat plugin itself would have to be named woocommerce/woocomerce.php in order to work!

In the future this shouldn't be so much an issues since WooCommerce will soon require WP5.x in order to work so it shouldn't be installed let alone activated on a CP site

@ghost
Copy link

ghost commented Nov 27, 2019

I have already discovered that you can't run WooCommerce and Classic Commerce together. Deactivating Woo is fine, but what happens if you decide to uninstall Woo and go ahead with using CC. Does that uninstall process remove anything - records, database tables, etc? - that might be needed by CC?

@timbocode
Copy link
Contributor

Deactivating and deleting WC does not appear to affect CC in any way. I've been testing it.

Despite the fact you get a "Are you sure you want to delete WooCommerce and its data?" message when deleting WC, the data and all the database tables remain in place.

When WC was activated, I altered a setting. I then deleted WC, activated CC and the setting was still in place. I even ran WP Optimize after deleting WC and before re-activating CC.

So unless anyone has found anything different, I would say that it's safe for WC to be installed, deactivated and deleted without it affecting CC. I've certainly not found anything to suggest otherwise.

However, I think a note should be added to the README to the effect that installing WC while CC is installed is not recommended and may have unexpected consequences. Take a backup if...blah...blah...blah...

@timbocode timbocode added this to the Version 1.0.0 milestone Dec 7, 2019
@bahiirwa
Copy link
Collaborator

bahiirwa commented Dec 7, 2019

Does that uninstall process remove anything - records, database tables, etc? - that might be needed by CC

No, it does not.

However, I think a note should be added to the README to the effect that installing WC while CC is installed is not recommended and may have unexpected consequences.

Maybe. I don’t think so however; CC and Woo can’t run along side each other since they have similar classes. Both don’t have namespacing so the clashes of classes and functions cause PHP errors.

@timbocode
Copy link
Contributor

CC and Woo can’t run along side each other since they have similar classes. Both don’t have namespacing so the clashes of classes and functions cause PHP errors.

I see no harm in adding a "Can I install both WC and CC at the same time?" question to a FAQ or something. And the advice would still be the same - we don't recommend it.

The issue is not so much about having both activated at the same time (which PHP will complain about) but more about potential consequences of having both installed, activating/deleting one and then the activating the other.

In the testing I did, nothing untoward happened but can we be 100% certain that nothing bad will happen out in the real world in all kinds of different scenarios?

@bahiirwa
Copy link
Collaborator

bahiirwa commented Dec 7, 2019

Agree

@ghost
Copy link

ghost commented Dec 7, 2019

They will certainly often have to be installed at the same time. What about when people want to switch from WC to CC? The scenario I followed was:

  1. Lets try out CC... loads up folder.
  2. Activate CC - get error message saying there is a conflict.
  3. Deactivate WC, try again. OK, that works.
  4. Check out CC. All looks good. Lets get rid of WC.
  5. Oops - scary message saying it will delete all my products and data.

@timbocode
Copy link
Contributor

Yes, but the scary message in 5. doesn't follow through. It's all bark and no bite. Maybe that needs to be added to the FAQ.

@bahiirwa
Copy link
Collaborator

bahiirwa commented Dec 8, 2019

This looks like a bug. Expectations are not met. Should we fix this in CC?

@timbocode
Copy link
Contributor

timbocode commented Dec 8, 2019

It's actually by design: https://docs.woocommerce.com/document/installing-uninstalling-woocommerce/

To force a full delete of data, tables, posts etc. you need to add define( 'WC_REMOVE_ALL_DATA', true); to wp-config.php.

I think this needs to be mentioned in the FAQ - i.e. firstly, we do not recommend installing WC when CC is already installed and secondly, make sure that define( 'WC_REMOVE_ALL_DATA', true); does not exist in wp-config.php.

As for CC, I think there should be a "Delete all data when removing CC?" option in the advanced settings section - with all relevant scary warnings etc.

See #142

@ghost
Copy link

ghost commented Dec 9, 2019

Now added as FAQ in readme file and PR submitted. I think that is enough for the first release.

I like the idea of a "Delete all data when removing CC?" option though. Maybe one to add down the track.

@bahiirwa
Copy link
Collaborator

I think we need to add an admin notice to make this Error message for meaningful for the ordinary user who might have skipped the documentation and also reduce the support call.

Screenshot 2019-12-22 at 14 50 39

Suggestion:

  1. User clicks to install CC.
  2. Stop CC install to Detect the WooCommerce ( Need to find a unique function to Woo not in CC ).
  3. Throw the notice to deactivate Woo.
  4. Notice provides: A link to the plugins deactivation for woo.
  5. User can now activate CC.

I know Woocommerce won't be supporting any forks after < WP 5.0. However someone might migrate with an older version of Woo. We have to have this in mind as we move with this ticket.

@timbocode
Copy link
Contributor

That would work well if we're working on the basis that we are not automatically deactivating WC. Your suggestion would mean that the user won't see the PHP error which is definitely a good thing.

But, what's best?

a) detecting WC then displaying a "friendly" message; or
b) detecting WC then automatically deactivating it as well as showing a friendly message saying WC has been deactivated and you might need the compat plugin.

@bahiirwa
Copy link
Collaborator

I am for option A. Let user deactivate their plugins.

@timbocode
Copy link
Contributor

Okay. That's fine. The main thing is that the user doesn't see the scary PHP error so go ahead as per your suggestion.

@bahiirwa
Copy link
Collaborator

I have opened up issue #152 to close this as the remaining action point. We have a number of issues and PRs that have span off this.

Can be re-opened if need be.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants