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.

Analyze WooCommerce settings

Analyze WooCommerce settings

From the course: WordPress Ecommerce: WooCommerce Plugins

Start my 1-month free trial

Analyze WooCommerce settings

- [Instructor] We're going to add settings to our own plug-in, but before we do, it's worth looking at exactly how Woocommerce display settings in the admin. There isn't any official documentation on this, so you have to dig into the code to understand it. I'll go to Woocommerce, includes, admin, and then wc-admin-functions. And then I'll scroll down until I get to Woocommerce admin fields. On line 135, this function is Woocommerce's own API for adding admin settings. In this function you can see that it accepts a parameter, here called options, and that parameter is an array of fields that we want to display on the settings page. The function first checks if another class exists with the same name, another instance of defensive coding, good job. And then it's calling a static function right down here. That's what the double colon means. Now you've likely seen static functions before, but just as a refresher, you tend to see static functions used as utility functions like formatting a…

Contents