Adding a Custom Method to a nopCommerce Core Service in a Plugin

In nopCommerce, you can extend a core service to include a new method and new functionality using both dependency injection and inheritance. For this example, we’ll use TaxService provided in Nop.Services.


First, create a new interface in your plugin that inherits from the core service interface:

After creating the interface, create the implementation class, inheriting from both the newly created interface and the base service:

Finally, make sure to connect the interface to the implementation in your plugin’s DependencyRegistrar.cs file:


Once the above is created, you can reference the new service using the interface created (usually, this is done in a controller or a service):