Make sure to edit the 3rd line path according to yours. (Replace: $node[“Set”].json[“Value”] with the item path from the Shopify trigger)
// Code here will run only once, no matter how many input items there are.
// More info and help: https://docs.n8n.io/nodes/n8n-nodes-base.function
var replace = $node["Set"].json["Value"]
// Loop over inputs and add a new field called 'myNewField' to the JSON of each one
for (item of items) {
item.json.Replaced = replace.replace(/\./g, ',');
}
// You can write logs to the browser console
console.log('Done!');
return items;
Thaanks @jan it worked. Here is what I finally did:
// Loop over inputs and add a new field called 'myNewField' to the JSON of each one
for (item of items) {
item.json.tvl = item.json.tvl.toString().replace(/\./g, ',');
}
// You can write logs to the browser console
console.log('Done!');
return items;
I needed the loop because withput it, every value was the same.