The story
Probably referring to the vegetables which spectators would pelt at the person drawn on the cart. Green's Dictionary of Slang suggests that the term is of onomatopoeic origin.
First known use, by meaning
- 18th c. To be taken through the streets on a cart while being whipped, as a punishment for certain crimes.
Etymology from Wiktionary, CC BY-SA 4.0.