Q7: How to Add a New Widget Zone if You Are Using One of Our Plugins?

Q7: How to Add a New Widget Zone if You Are Using One of Our Plugins?

NopCommerce FAQs - a quick answer to the most burning nopCommerce questions.

In this short article, we will explain how to add a new widget zone to the JCarousel plugin. You can apply the same steps to any other plugin which uses widget zones.

First, you will need to add a new widget zone to the plugin you are using. You need to go to the ~/Plugins/SevenSpikes.Nop.Plugins.JCarousel/ directory and edit the SupportedWidgetZones.xml file.

Add a new <WidgetZone> tag to the xml document and specify your widget zone name inside it. Please note that the name of the widget zone should be unique, for example, <WidgetZone>jcarousel_widget_zone</WidgetZone>.

After that, restart your store and go to Administration -> Nop-Templates -> Plugins -> JCarousel -> Manage Carousels and edit your carousel. Select your newly created widget zones from the Widget Zones tab and save the carousel.

The final step is to call your widget zone in one of the views (cshtml files) of nopCommerce. To do that, you will have to write the following line of code anywhere in the views (located in the ~/Views directory of your nopCommerce application). There are no limitations to where the widget zone can be called.
@await Component.InvokeAsync("Widget", new { widgetZone = "jcarousel_widget_zone" }).

When you make all the changes, you need to restart your store, and your carousel will be displayed on your custom location.

Coming up next: How to restrict the shipping methods in your nopCommerce store to a particular country/s?

Do you have a nopCommerce related question that is bugging you? Share it in the comments below, and we will provide an answer.