Umbraco Commerce Packages
CMSCloudHeartcoreDXP
  • Packages for Umbraco Commerce
  • Commerce Products
    • Umbraco Commerce
    • Commerce Payment Providers
    • Commerce Shipping Providers
  • Cart
    • Overview
    • Installation
    • Configuration
    • Release Notes
  • Checkout
    • Overview
    • Installation
    • Configure Umbraco
    • Customize Checkout
    • Checkout Screenshots
    • Release Notes
  • Deploy
    • Overview
    • Installation
    • Deploying Changes
    • Release Notes
  • Product Feeds
    • Overview
    • Installation
    • Extending the plugin
    • Release Notes
Powered by GitBook
On this page

Was this helpful?

Edit on GitHub
Export as PDF
  1. Product Feeds

Extending the plugin

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

PreviousInstallation

Last updated 1 year ago

Was this helpful?

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 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 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.

DefaultGoogleAvailabilityValueExtractor.cs
Collection Builder pattern
property value extractor dropdown