Simple trick to check WooCommerce Plugin activation status

As A WordPress plugin developer, I believe it is a very good practice to check plugin dependencies before activating our own plugin.

Yesterday, I was working on couple of updates for WooCommerce Product FAQ Manager. Suddenly, it’s stopped working and displaying error message. I found, I forgot to activate WooCommerce Plugin. So, I’ve added following lines of code to check if WooCommerce plugin has been installed and activated in my site or not.

If WooCommerce plugin installed and activated then WooCommerce Product FAQ Manager run it’s own code. Other wise, it displays a notification message in admin panel to notify admin user to active WooCommerce plugin. Super easy ! Right?

if ( is_plugin_active( 'woocommerce/woocommerce.php' ) ) {

  // Write your code if WooCommerce Plugin activated.

} else {

  // Write your code if WooCommerce Plugin is disabled.
  // You can display notice message in here.


I hope this quick technique will help you in your project. Let me know your feedback in the comment comment box.

Thanks and Enjoy !

Total 0 Votes

Tell us how can we improve this post?

+ = Verify Human or Spambot ?

Leave a Comment

Back To Top