Subscribe to Newsletter
#

How To Create a nopCommerce Plugin

NopCommerce is by far, one of the most versatile and powerful virtual shopping carts. Its functionality can be further extended by the use of plugins. Hence it is important to understand how to create a nopCommerce Plugin.

NopCommerce has its own set of plugins to start with

NopCommerce actually comes equipped or distributed with multiple plugins of different functionality. One can search for additional ready to use plugins on the nopCommerce official website too. But the knowledge of how to create a nopCommerce plugin is essential to make the website with nopCommerce implementation, further potent and useful.

Plugins are highly important in the manner that they substantially extend the functionality of nopCommerce. Some plugins are used in payment methods like PayPal to calculate shipping costs and methods, etc. There are few informational plugins such as widgets too which offer live chat functionality. Given the importance of plugins, let us see how to create a NopCommerce Plugin.

How To Create a NopCommerce Plugin

The first step towards creating a nopCommerce Plugin is to create a new "Class Library" project. All the plugins should be placed in the \Plugins directory in the root. Pre–deployed plugins are in the \Nop\Plugins. One should not mix these up.

Once the Plugin is created, the project build output path should be updated. This ensures appropriate plugin DLLs are automatically copied to the \Presentation\Nop.Web\Plugins\ directory which is searched by the nopCommerce core for valid plugins.

Created Description.txt

It is essential to create a Description.txt file for each plugin This file essentially contains meta information describing the created plugin. One can easily select a pre–created file for another plugin and modify the same. Follow the standard content regulation and your Description.txt file will be ready quickly. A simple example of Description.txt file is as below

Group: Payment Methods
FriendlyName: Debit Card
SystemName: Payments.AuthorizeNet
Version: 2.00
SupportedVersions: 2.30
Author: ABC Team
DisplayOrder: 1
FileName: Nop.Plugin.Payments.AuthorizeNet.dll

Here the SystemName field is always unique. The Version simply denotes the current version of the created Plugin. SupportedVersions field may contain a list of supported nopCommerce versions. Multiple values, can be entered separated by a comma. In case of FileName, using the following string is recommended; Nop.Plugin.{Group}.{Name}.dll. One must ensure that "Copy to Output Directory" property of this file is set to "Copy if newer".

Create a class which implements IPlugin interface

The final step is to create a class which implements IPlugin interface. nopCommerce already has BasePlugin class which implements some IPlugin methods and allows one to avoid source code duplications.

Creating nopCommerce Plugins is easy, but one has to be aware that upgrading nopCommerce can make the plugins non–functional. Some plugins can become outdated. Under such circumstances, one can easily check for newer variants. NopCommerce developers however, are so versatile and adaptable that many plugin authors will upgrade their plugins to accommodate the newer version. But, if they don't and you have created a plugin, simply appending the SupportedVersions Field in the Description.txt file should be enough to make the plugin compatible with the updated nopCommerce again. So, go forth and create nopCommerce Plugins. They will surely extend the functionality of nopCommerce as much as technically desired. We hope the above information on how to create a Nopcommerce plugin has been useful.

Do Contact Us for information on how to create a Nopcommerce plugin.