If you are developing a Plugin which is dependent on another plugin, in such cases, we need to check if plugin is activated or not. To give an example, if you need to build a plugin which stores favorite products on wishlist, then you need to check if Woocommerce is activated or not.
WordPress doesn’t provide this facility by default. But, we can achieve this through simple step. There are various methods for this. Let’s check WordPress default
Tip: New in WordPress? Don’t forget to read Template Hierarchy in WordPress.
If the above function does not work for you, there is an alternative. We can check if plugin class exists or not. This is a default PHP function which accepts class name as a parameter. Some of the popular plugins and checks if they are activated or not is given below: