Excerpted from the sourcesheet of this shiur: https://www.yutorah.org/lectures/lecture.cfm/923026/rabbi-mordechai-djavaheri/dayenu-scallion-whips-of-gratitude/
The custom in Jewish communities of Iran, Kurdistan, Bukhara, Afghanistan(Not Tunis) is to whack each other with scallions during the recitationof Dayenu at the seder. While authoritative sources for this custom are unknown, a number of suggestions have been madefor thereason behind this animatedsegment of the Seder:
Maintaining participant attentiveness.
R' Mazuz –tosefet Simcha, look forward to it eagerly
Mitzrim beating Jewish slavesa.
Ohr Torah journal –they screamed “Day!” when they were getting beaten in Mitzrayim
Some say it’s a siman that you should grow like the scallion.
Some say it’s a purely Mashadi custom, starting with one instance where a secret seder was found by Muslims and the Jewish father
pretended to be beating his son with the scallion to make it look like
it wasn’t a seder
A nice idea appears in Yated HaMeir: Klal Yisrael
complained about what they had in Mitzrayim, including betzalim. This
is the tikkun -had Hashem only done these things, dayenu, we aren't
complaining, for this step alone we would've had ample reason to be
thankful. Even for taking us out of the beatings of being a slave,
would've been enough -whipping each other. Be safe