Example match abebooks prices

This script will change your price to MATCH the lowest offer in ANY CONDITION on AbeBooks. If there isn't competition, the script will use your Base Price.

This script applies a price floor of Cost or $1, whichever is greater.

You can change the price floor from ((1.00)) in the script below, if desired.

Example Code

// match abebooks prices

var item = FILLZ.ITEM.v1;

// default price
var price = item.base_price;
// price floor
var floor = Math.max(item.cost, 1.00);

// match lowest price offer from abebooks
var lowest = FILLZ.SOURCE.ABEBOOKS.v2.offers().lowest_price_offer();
if (lowest) {
  debug('matching lowest price: '+lowest);
  price = lowest.price;
}

//apply price floor
if (price < floor) price = floor;

return price;