How to add feed columns using a parser function
Parser function is useful when modification on the feed is required, such as changing column values and adding new columns.
A parser function is a JavaScript function and it can be written in multiple ways.
In this post, I'm specifically providing an example of how to use a parser function to add a new columns to your feed.
function parse(data){
return data.map(function(item){
item.newColumnName = condition ? value_if_condition_is_met : value_if_condition_is_not_met;
return item;
});
}
"condition" can be any valid condition. For instance, item.in_stock == true.
Please sign in to leave a comment.
Comments
1 comment