Can anyone explain the function of this op-amp in a Velleman Clap On/Off Switch?
The LM324 is an integrated circuit containing four operational amplifiers; this is a common arrangement for cost savings as it allows for less integrated circuits to be used on a board, and lower package costs (which can dwarf wafer fabrication costs in many cases).
Three operational amplifiers are needed for this design; a single quad-op-amp chip is easier and cheaper to use than a dual op amp and a single op amp. By leaving the pins connected as-is (output to inverting input, non-inverting input to ground), the unused op-amp is in a well-defined state where it is unlikely to oscillate, use high amounts of power, or interfere with the correct operation of the other op-amps on the chip.
There is further reading in this tech note from TI. In a single-supply-rail application such as this one, setup recommended by TI is to use a resistive divider to pull the non-inverting input somewhere between the rails:

However, the tech note goes further:

If the implementation of extra resistors is undesirable, the non-inverting input can be connected to any reference voltage that is within the specified common mode and output ranges.This technique favors an op-amp with rail-to-rail input and/or output range characteristics.

Checking the datasheet for the LM324, the common-mode input range and output swing do indeed go all the way down to ground.