Parsing feeds using transform
the Product Feed assumes a number of default field values including but not limited to title
, price
, url
, and so on. If your field exposes these values using different names they can be "re-wired" to match the corresponding values in the Hello Retail API. This is done using the Feed Transform by adding/editing a feed in Data Setup -> Feeds in the My Hello Retail dashboard.
Mapping a direct child property
In this example data, the product url is delivered to us as productLink
. We are therefore going to manually map this property to url
in the Hello Retail data model.
{
"type": "product_page",
"id": "{product id}",
"sku": "{product sku}",
"productLink": "<https://example-shop.com/product/party-hat>",
}
productLink
to url
, from product data:
function transform(product:any): TransformationResult {
return {
...product, /* map default fields */
url: product.productLink /* manually mapped url. */
};
}
Mapping a property that is nested within an object
In this example data, the product prices are delivered to us in an object that exists at the root of the product data. The auto mapper won't be able to read these prices due to the data structure. Furthermore, it most likely would not understand that defaultPrice should be mapped to our price variable because the name is not similar enough to "price".
{
"type": "product_page",
"id": "{product id}",
"sku": "{product sku}",
"productLink": "<https://example-shop.com/product/party-hat>",
"prices":{
"defaultPrice": 200,
"originalPrice": 180,
}
}
price
and originalPrice to oldPrice
, from product data:
function transform(product:any): TransformationResult {
return {
...product, /* map default fields */
price: product.prices.defaultPrice,
oldPrice: product.prices.originalPrice
};
}