Example Script to Show Listings of a Certain Weight

I needed to retrieve listings weighing between 12 and 16 ounces, so I created this simple script to show them in the console. Might help someone doing something similar.

function run(){
	for (const listing of selectedListings) {
  var pounds = listing.shippingOptions.packageWeightMajor;
  var ounces = listing.shippingOptions.packageWeightMinor;
  var weightInOunces = (pounds * 16) + ounces;
  
  if ((weightInOunces >= 12) &&  (weightInOunces <= 16)) {
      consoleLog(listing.title + " is " + weightInOunces + " oz");
    } 
	}
	consoleLog("done");
}
2 Likes