Creating a plugin for WooCommerce

Want to create a plugin to extend WooCommerce? Plugins are essentially the same as regular WordPress plugins so for information on writing them see Writing a plugin

There is one difference however which you can optionally implement – you can wrap it in a check to see if WooCommerce is installed or not:

 * Check if WooCommerce is active
if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
    // Put your plugin code here

Main file naming ↑ Back to Top

The main plugin file should take the name of the plugin directly. E.g. a plugin called woocommerce-some-plugin would have it’s main file named woocommerce-some-plugin.php

Textdomains ↑ Back to Top

To follow the guidelines in, the text domain should match your plugin folder name. E.g. a plugin called woocommerce-some-plugin would have the text domain woocommerce-some-plugin. No underscores.

Back to the top