← All comics

Last week's teabags

#177

Toby put Pip's new 'buy it again' button live and tested it on a box of teabags. It re-bought every order he had ever placed, both of his sofas included.

The mistake

The 'buy it again' handler doesn't use the ID of the order the button sits on. It fetches the user's whole order history and places a new order containing all of it. The fix guesses the target as 'the most recent order' instead of passing the order ID in. Because the buggy click has just created a new order, the most recent order is now that £4,112 bundle, so the 'fixed' button re-buys it. There's also no confirmation step or duplicate check to catch the second click.

Share