This script checks if a specific attribute already exists and - if not - adds it with the given value to all selected listings.
Feel free to modify and improve it to fit your needs.
Disclaimer:
- You might want to test this script with one single listing first.
- There’s no undo function.
More about GarageSale’s javascript feature
// This script checks if a specific attribute (attrKey) already exists and - if not - adds it with the given value (attrValue) to all selected listings
function run(){
for (const listing of selectedListings) {
const attrKey = "Country/Region of Manufacture"; // Enter attribute (item specific) that you want to add
const attrValue = "United Kingdom"; // Enter attribute value
if (!listing.attributes[attrKey]) {
for (const listing of selectedListings) {
let attributes = listing.attributes;
attributes[attrKey] = attrValue;
listing.attributes = attributes;
consoleLog(listing.title + ": Successfully added Attribute '" + attrKey + "'")
}
} else {
consoleLog(listing.title + ": Attribute '" + attrKey + "' already exists")
}
}
}
To use this script open GarageSale’s script editor, click the + button and paste the script. Select one or more listings in GarageSale’s main window, then click the “Run” button in script editor.