Bulk-editing Bandcamp per-track pricing
Bandcamp recently rolled out bulk editing for albums, but unfortunately it only lets you bulk-edit album prices, rather than the prices of individual tracks within an album. Fortunately, it isn’t too difficult to do this with a little Javascript.
For each album that you want to change the prices on:
Open up your album’s editor
Open up your browser’s Javascript console (usually using ctrl-alt-I on a PC, or cmd-alt-I on a Mac)
Paste in this bit of code (assuming you want to set the price to 1.50 per track in your local currency; change the
'1.50'to whatever value you want it to be otherwise) and press Enter:document.querySelectorAll('input.price[name^="track.price"]') .forEach(e=>{e.value='1.50';e.dispatchEvent(new Event('change'))})
Verify that the prices are the way you want them and then click “update album”
Note that copy-pasting random Javascript from the web is generally unsafe to do, so I’ll explain exactly what this code does:
document.querySelectorAllasks the browser to give a list of items on a webpage; in this case, the queryinput.price[name^="track.price"]asks for all of the text inputs which have aclassofpriceand anamestarting withtrack.price, which is how Bandcamp marks a text input as being a track priceforEachruns a function on each of the text inputs; in this case, for each one, it- sets the
valueattribute (which is the text in the box) to1.50 - notifies the browser that the value has changed (which is necessary because Bandcamp is using custom validation and data binding logic)
- sets the
Anyway. This is still not great, process-wise, but it’s a lot easier than having to edit every single track manually.