Modules
Learn how to use modules.
Last updated
Learn how to use modules.
Last updated
A module is a piece of program in a plugin that performs a particular task, or it can function with other modules. The WooCommerce plugin has seven core modules:
module
module
module
module
module
module
module
A module is a piece of program in a plugin that performs a particular task, or it can function with other modules.
The module interface is for any module that needs to be registered with the plugin. Custom modules need to implement this interface for registration.
$module->name(): This method needs to return module name.
The module name can be alphanumeric without spaces. Dashes and underscores are allowed.
$module->init(): Any actual work or initialization activity related to the module should go inside this method.
Example: You can add any hooks or call necessary functions/methods inside init
to run the module.
To register the custom module:
Create the main module class that either implements the Module
interface or extends the BaseModule
abstract class. Since most of the modules will only be functioning when you enable the Digital River payment gateway, it makes sense to extend the BaseModule
class.
Add the module name by returning the name
method to the Plugin::$active_modules
list.