Building a basic WooCommerce plugin
To get started, we want to build a plugin that will run when WooCommerce is activated on a site. If WooCommerce is not active, we don’t want our plugin to run, because that’s a waste of processing power.
We’re going to create a plugin and then we’ll configure it to only load when WooCommerce is active. We need to start by creating a plugin file.
Creating a plugin
To get started, we need to create the plugin files. Plugins are typically stored in the WordPress filesystem under wp-content/plugins/{your-plugin}
.
There are two ways of creating plugin files:
- Use a single plugin file that contains the entire plugin
- Use a folder with multiple plugin files
The vast majority of plugins use multiple files, so we’re going to create a folder for our plugin. Follow the steps given here:
- Under
/wp-content/plugins/
, add a folder for your plugin. I’m going to call minewoocommerce-example...