Join Patrick Rauland for an in-depth discussion in this video WordPress and WooCommerce hooks, part of WordPress Ecommerce: WooCommerce Plugins.
- [Instructor] Throughout this course, we're going to be using hooks within WooCommerce to make changes to how WooCommerce works. Now as you can see from the documentation, there are literally hundreds of hooks. They control really big things, like what is in the cart and how much does the order cost, all the way down to the small things, like should the welcome wizard run when you first install WooCommerce. What's great is that WooCommerce hooks are WordPress hooks. Functionally speaking, there is no difference, so if you know how to work with filters and actions in WordPress, then you know how to work with filters and actions in WooCommerce.
The downside is that it's sometimes hard to find the right hook. This is a huge list, and it's not always obvious which one to use. So if you wanted to build a settings screen for a plug-in, where would you find that hook? You could maybe start here in Admin, look through some of these links. But it's a bit of a mystery. You may have to look through the code, but there's another resource you should check out first. This page tells you how to create a plug-in for WooCommerce. And they answer some common questions, like "Where do you want to put a settings page?" So if you're integrating with another service, they have the integration class.
If you're building a settings page for your own plug-in, you might want to add something to the settings screen. And they have further documentation. And if you want to click through to the link, this is the page that shows you how to add a section to a settings tab. Now throughout this course, we're going to go over all the major areas of WooCommerce, so we'll cover the settings page, the edit product page, the front end product page, the check out, and a few other areas. But depending on what you want to do, you might have to go digging through the code to find the exact right hook.
If you want to customize a premium WooCommerce plug-in, like subscriptions, bookings, or memberships, or some other WooCommerce plug-in, you can use the same techniques you learn here, in this course, to customize those plug-ins. So just remember, customizing WooCommerce is all about finding the right hooks. If they exist, and you can find them, then you can do anything. I'll show you some of the most popular hooks, where to find them, and how to use them.
- Creating a WooCommerce plugin
- Finding hooks within WooCommerce
- Creating settings pages
- Analyzing WooCommerce settings
- Configuring settings
- Customizing the edit product page
- Using hooks on the product page
- Customizing the WooCommerce checkout
- Adding custom order statuses
Skill Level Intermediate
Q: This course was updated on 08/07/2018. What changed?
A: The following topics were updated: adding a meta box, saving product fields, customizing product titles, and adding data to product page tabs.