i have this function mapLocationOverrides it take two parameters items and locationId
inside the function i have a variable variations which filters trough items and returns all the items with the object location_overrides. then im looping through variations and every time the if statement is true the im not able to log data ousid that foreach loop it keeps breaking.
function mapLocationOverrides(items, locationId) {
let variations = _.flatMap(items, 'variations').filter(v => {
return 'location_overrides' in v && v.location_overrides.length;
});
_.forEach(variations, v => {
let locationOverride = _.find(v.location_overrides, ['location_id', locationId]);
if (locationOverride.price_money) {
v.price_money = locationOverride.price_money;
delete v.location_overrides;
}
});
return items;
}
Aucun commentaire:
Enregistrer un commentaire