Extending the plugin

Learn how to extend the plugin by adding a custom property value extractor.

In this article, you can find an example of extending the plugin by adding a custom property value extractor.

Add a custom property value extractor

When a default property value extractor does not suit your need, you can create your own extractor to extract the property value yourself.

For example, when a product's stock value is 0, Google Merchant Feed desired value is out_of_stock. In that case, we have DefaultGoogleAvailabilityValueExtractor.cs to do the conversion from 0 to out_of_stock.

You can often create a new implementation of ISingleValuePropertyExtractor or rarely IMultipleValuePropertyExtractor.

This plugin uses Collection Builder pattern which is commonly used in Umbraco. You can use these two extension methods during application initialization to add your value extractors.

// IUmbracoBuilder builder;
builder.SingleValuePropertyExtractors()
    .Append<DefaultSingleValuePropertyExtractor>()
    .Append<DefaultGoogleAvailabilityValueExtractor>()
    .Append<DefaultMediaPickerPropertyValueExtractor>();

builder.MultipleValuePropertyExtractors()
    .Append<DefaultMultipleMediaPickerPropertyValueExtractor>();

Afterwards, your extractor name should show up in the dropdown under Property And Node Mapping section.

Last updated