Override the default Rendering View Provider

Current version: 9.0

Each view (.cshtml file) stores the HTML for rendering on the storefront. Do not modify the .cshtml files because they are overwritten when software updates are installed. Instead, define an alternative location for customized views in the CustomRenderingViewPath setting for a site.

Using the Rendering View Provider, you can override views on a site-by-site basis. This provider is part of the XC Storefront Foundation assembly and uses IoC. The default behavior is to allow for the use of a different root folder other than ~/Views.

When you specify the path in the CustomRenderingViewPath field, the custom rendering view folder is checked first to determine if the file is present. If it is not present, the default ~/Views version of the view is used.


The structure of the custom folder must be the same as that within the ~/Views folder for Storefront‑related components.  For example, if /Views/Commerce/Catalog/ProductPrice.cshtml is to be overridden, it must be placed in the following path of the custom views folder: /<CustomViews>/Views/Commerce/Catalog/ProductPrice.cshtml.

The custom views folder, on disk, must contain a copy of the web.config file found within the ~/Views folder.


The Rendering View Provider is registered in the Sitecore.Commerce.XA.Foundation.Common.config configuration file.


       <register serviceType="Sitecore.Commerce.XA.Foundation.Common.Providers.IRenderingViewProvider,
 Sitecore.Commerce.XA.Foundation.Common" lifetime="Singleton"/>

You can implement the IRenderingViewProvider interface and replace the current implementation by adjusting the configuration file accordingly.

Do you have some feedback for us?

If you have suggestions for improving this article,