From the course: WordPress Ecommerce: WooCommerce Plugins

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Add fields to a product tab

Add fields to a product tab

From the course: WordPress Ecommerce: WooCommerce Plugins

Start my 1-month free trial

Add fields to a product tab

- We've added our Product Data tab. Now we want to add fields to it, but before we can add fields, we need to know the action that's running on this page, and then we can use that action to add our fields right here. If we go to the code and then we go to WooCommerce includes admin meta-boxes and now views, make sure views is open, and then go to html-product-data-panel. We can see the entire layout of the product data area, including, at the very bottom, the action that we need. Now if you're wondering how I got here, it's by digging into the code. There isn't any documentation on this so I searched the codebase for product data tabs or product data panels and eventually found this file. So the bottom of the file is the action we need. You can copy this to our custom plugin, and right here beneath our add filter, we're going to add an action. I'll paste in that name, so we're going to reference a method within this object, I'll call this one woocommerce_product_data_panels, and now…

Contents