ClassicCommerce - 2 issues on installation

I’m building an e-commerce site and decided to go with CC. I have not paid much attention to the development discussions on the forum, so you can consider me fairly uninformed about the plugin. After installing and activating, I notice two things:

  1. On the admin menu, the plugin shows as ‘WooCommerce’, although it does show the CC wallet icon. Not really a problem, but disconcerting.

  2. When I click on ‘WooCommerce’ I get a blank page with the following message: ‘Cannot load woocommerce.’
    The link that shows this message: /wp-admin/admin.php?page=woocommerce
    All the dropdown links under ‘WooCommerce’ work as expected. Am I missing an overview page or something?

Which version of the plugin did you install / where did you get it from? The latest version should not have either of these issues. In particular if I click on “Commerce” in the admin menu then it directs me to wp-admin/edit.php?post_type=shop_order.

Not really sure where I downloaded it (there are a few places where it seems to be available), but version is 1.0.0-beta.1

OK, for some reason, now the label just says ‘Commerce’ rather than ‘WooCommerce’. Not sure why this happened (BTW, did not have WooCommerce installed prior to installing CC).

Secondly, I use a plugin called ’ Ozh’ Admin Drop Down Menu’ because I prefer all the admin links at the top of the page rather than down the side.

When I deactivate Ozh plugin, the ‘Commerce’ link is /wp-admin/edit.php?post_type=shop_order as you described. When I reactivate it, the link is once again /wp-admin/admin.php?page=woocommerce

I’ve never seen a variation in link with Ozh menu and the standard WP side menu (probably been using Ozh for about 8 years, on more than 60-70 websites). So, this is baffling.

1 Like

Classic Commerce had to jump through some hoops to have the name in the admin menu be “Commerce” but still keep the same menu slug of WooCommerce for compatibility with some Woo extensions.

It looks like this dropdown menu plugin doesn’t understand how to deal with that situation. I am pretty surprised this is the first time you’re seeing issues with this plugin, since it is also trying to do something that is not even close to what the wp-admin code intends, and also jumping through a bunch of hoops in the process.

I installed the Ozh plugin and get slightly different behavior than what you described: the main link to Commerce goes to /wp-admin/woocommerce which is completely broken (404 from the web server). That may be because my dev install doesn’t have pretty permalinks enabled at the moment. Hopefully you can confirm that your link actually points to /wp-admin/woocommerce and then redirects to /wp-admin/admin.php?page=woocommerce, as that would make a fix/workaround easier.

In any case here is a workaround that works for me, put in a mu-plugin or functions.php:

<?php

add_action( 'toplevel_page_woocommerce', function() {
?>
<p class="hide-if-no-js">Redirecting to Classic Commerce...</p>
<p class="hide-if-js"><a id="cc-admin-link" href="<?php echo esc_attr( admin_url( 'edit.php?post_type=shop_order' ) ); ?>">Click here</a> to go to Classic Commerce</p>
<script>document.location.href = document.getElementById( 'cc-admin-link' ).href;</script>
<?php
} );
2 Likes

Yup, that does resolve the link issue with Ozh Menu.
Thanks!

1 Like

Glad it worked! For future reference this does 2 things at once:

  • Makes the Ozh plugin change its menu item URL, changing from this if branch to this one, since the toplevel_page_woocommerce action now has a callback function present which changes the return value of get_plugin_page_hook. This is not something that should be added to Classic Commerce in this form as it may have other effects!
  • Makes the /wp-admin/admin.php?page=woocommerce page actually do something (in this case, just redirect to Classic Commerce orders).
2 Likes

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.