Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Admin notice add user friendly Error message for non Dual CC-Woo Install #152

Closed
bahiirwa opened this issue Dec 25, 2019 · 4 comments · Fixed by #154 or #157
Closed

Admin notice add user friendly Error message for non Dual CC-Woo Install #152

bahiirwa opened this issue Dec 25, 2019 · 4 comments · Fixed by #154 or #157
Assignees
Labels
enhancement New feature or request

Comments

@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.

Originally posted by @bahiirwa in #136 (comment)

@bahiirwa bahiirwa added the enhancement New feature or request label Dec 25, 2019
@bahiirwa bahiirwa self-assigned this Dec 25, 2019
@bahiirwa bahiirwa added this to the Version 1.0.0 milestone Dec 25, 2019
@nylen
Copy link
Contributor

nylen commented Dec 26, 2019

  1. Stop CC install to Detect the WooCommerce ( Need to find a unique function to Woo not in CC ).

Probably a better way to handle this is to stop Classic Commerce from loading just before the declaration of the function wc() in Classic Commerce, something like this:

function cc_wc_already_active_notice() {
    echo '<div class="error"><p>';
    echo __( 'You must deactivate WooCommerce before activating Classic Commerce.', 'classic-commerce' );
    echo '</p></div>';
}
if ( function_exists( 'wc' ) ) {
    // The main wc() function already exists, which means WooCommerce is active.
    // Show an admin notice.
    add_action( 'admin_notices', 'cc_wc_already_active_notice' );
    // Deactivate Classic Commerce.
    deactivate_plugins( array( 'classic-commerce/classic-commerce.php' ) );
    // Do not proceed further with Classic Commerce loading.
    // (may need tweaking depending on code structure)
    return;
}

function wc() {
    // ... (existing code)

@timbocode
Copy link
Contributor

This looks good to me.

@nylen
Copy link
Contributor

nylen commented Dec 27, 2019

Looks like this was closed by mistake? The PR #154 does something else.

@nylen nylen reopened this Dec 27, 2019
@bahiirwa
Copy link
Collaborator Author

Good catch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
3 participants