Reader small image

You're reading from  Mastering WooCommerce - Second Edition

Product typeBook
Published inApr 2024
PublisherPackt
ISBN-139781835085288
Edition2nd Edition
Concepts
Right arrow
Author (1)
Patrick Rauland
Patrick Rauland
author image
Patrick Rauland

Patrick Rauland is obsessed with WooCommerce. He has used it as a customer, worked for WooCommerce support, developed core functionality in WooCommerce itself, led three releases, and helped plan their yearly conference (WooConf). He now helps people by writing his blog, creating courses for LinkedIn Learning/Lynda, and writing books. Patrick is also the co-founder of WooSesh, an online conference for WooCommerce developers and store owners. Patrick lives in Denver, Colorado, where you can probably find him at a local coffee shop, typing away
Read more about Patrick Rauland

Right arrow

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:

  1. Under /wp-content/plugins/, add a folder for your plugin. I’m going to call mine woocommerce-example...
lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Mastering WooCommerce - Second Edition
Published in: Apr 2024Publisher: PacktISBN-13: 9781835085288

Author (1)

author image
Patrick Rauland

Patrick Rauland is obsessed with WooCommerce. He has used it as a customer, worked for WooCommerce support, developed core functionality in WooCommerce itself, led three releases, and helped plan their yearly conference (WooConf). He now helps people by writing his blog, creating courses for LinkedIn Learning/Lynda, and writing books. Patrick is also the co-founder of WooSesh, an online conference for WooCommerce developers and store owners. Patrick lives in Denver, Colorado, where you can probably find him at a local coffee shop, typing away
Read more about Patrick Rauland