On a few occasions I had to store properties in a Commerce project that were specific to each Commerce product catalog. It would be very nice to just add custom content properties to the root catalogs.
That was not possible, because CatalogContent
was protected against deriving with custom properties. But since the release of Commerce 14.13.0 we can finally create a custom content type, from CatalogContent
, and add our own properties.
Then, to see the data, simply load the node as the custom type, instead of the default CatalogContent
.
Here is a sample class:
using System.ComponentModel.DataAnnotations;
using EPiServer.Commerce.Catalog.ContentTypes;
using EPiServer.Commerce.Catalog.DataAnnotations;
using EPiServer.DataAnnotations;
Namespace MyWebshop.Features.Catalog;
[CatalogContentType(GUID = "90D80E58-A287-4978-91E6-C7BE450BCD17")]
public class CustomCatalogContent : CatalogContent
{
[CultureSpecific]
[Required]
public virtual string FeedName { get; set; }
}