Discount items added before date

This script will apply a 15% discount to items added to Fillz prior to July 2006. Date 2006-7-1 (YYYY-MM-DD) and discount (0.15) can be changed as needed.

var item = FILLZ.ITEM.v1;
var discount = 0.15;
var price = item.base_price;
var date1 = item.open_date;
var date2 = '2006-7-1'.split("-");
date2 = new Date(date2[0],(date2[1]-1),date2[2]);

if (date1 < date2) {
  return price * (1 - discount);
}
Have more questions? Submit a request