> For the complete documentation index, see [llms.txt](https://docs.digitalriver.com/woocommerce/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.digitalriver.com/woocommerce/1.0-1/developer-documentation/module.md).

# Modules

### Core modules

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:&#x20;

* [`Logger`](/woocommerce/1.0-1/developer-documentation/module/api-logger-module.md) module
* [`OrderManagement` ](/woocommerce/1.0-1/developer-documentation/module/ordermanagement-module.md)module
* [`ProductCheckout`](/woocommerce/1.0-1/developer-documentation/module/productcheckout-module.md) module
* [`ProductMetaFields`](/woocommerce/1.0-1/developer-documentation/module/productmetafields-module.md) module
* [`ProductSync`](/woocommerce/1.0-1/developer-documentation/module/productsync-module.md) module
* [`Settings`](/woocommerce/1.0-1/developer-documentation/module/settings-module.md) module
* [`TaxCalculation`](/woocommerce/1.0-1/developer-documentation/module/taxcalculation-module.md) module

A module is a piece of program in a plugin that performs a particular task, or it can function with other modules.

### Module interface

The module interface is for any module that needs to be registered with the plugin. Custom modules need to implement this interface for registration.

{% tabs %}
{% tab title="PHP" %}

```php
interface Module {
    /**
     * Initialization of module.
     *
     * @return void
     */
    public function init(): void;

    /**
     * Return module name.
     *
     * @return string
     */
    public function name(): string;
}
```

{% endtab %}
{% endtabs %}

### **Method description**

* **$module->name()**: This method needs to return module name.&#x20;

  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.&#x20;

  **Example**: You can add any hooks or call necessary functions/methods inside `init` to run the module. &#x20;

{% hint style="info" %}
Do not explicitly call the `init` method. The plugin calls the`init` method during module activation (under the hood).&#x20;
{% endhint %}

### **Register the custom module**

To register the custom module:

1. 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.  &#x20;
2. Add the module name by returning the `name` method to the `Plugin::$active_modules` list.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.digitalriver.com/woocommerce/1.0-1/developer-documentation/module.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
