Join Patrick Rauland for an in-depth discussion in this video When to customize the edit product page, part of WordPress Ecommerce: WooCommerce Plugins.
- [Instructor] We've talked about adding a Settings page, and this is useful for site-wide settings. But if you have settings that apply to individual products, you'll likely want to configure and save those on the Edit product page. Now, there are a couple of places you could display these settings. If you've never customized or extended another plugin, you may think it's best to add a custom meta box. Lots of plugins add custom meta boxes to various pages. If you're using Yoast SEO, you'll see that it adds its own fancy meta box right about down here.
And if you're adding a brand-new type of data to pages, posts, or products, that's probably a good idea. But when you're customizing or tweaking existing functionality, it's a best practice to build your customizations right next to the original settings. So let's say you want to add some information to the Product page, you want to add delivery instructions. For smaller items, you don't need to say anything, but for larger items like a couch, you can't just leave that on the doorstep. And your users might want to add a custom delivery message. Now that is related to shipping, so as WooCommerce, we have this Product data tab here.
And we want to put it under the Shipping tab. Let's say you wanted to add some information about the tools required to build the furniture, saying you need to have a hammer and a screwdriver, et cetera. That could probably be its own tab, since it doesn't relate to Inventory, or the General settings, or Shipping. Or you could maybe put it under the Advanced tab. Now let's say you want to customize the way the product page looks. You might have a couple of different formats. One with one side bar, and one with two side bars. That is similar to Post Format functionality in WordPress.
So I'd build on top of this functionality rather than customizing it all yourself. And if you want to have custom functionality that announces when your product is released, and maybe it re-announces it a week later on social media, you might want to put that right here, next to the Publish information. Because this is where you publish and schedule your posts to be published. So just make sure that you put your settings in logical places. Don't think about this from the developer point of view, think of this from the user's point of view and how they'll find these settings.
This is one of the things that separates a good developer from a great developer. If you don't know where to put your settings, take a look at other plugins, especially other WooCommerce plugins that do similar things.
- 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