Building Alarm to Prevent Theft - Need Coding Help

I thought the same at first, but the products are all in square boxes that are designed to fall face down flat in the dispensing area, well below the IR Sensor, so all I need is the 2 seconds that it takes for the Reed switch to return to a closed position. So I don't think that's an issue.

I have a question in regards to your suggestion though. If I put a 10 second delay on the buzzer upon detecting an open reed switch, that product would still be passing by the IR sensor as it is dispensed and wouldn't it passing by the IR sensor trigger the alarm, regardless of the 10 second delay on the read switch?

Or as long as the product passes by and clears the IR Sensor within that 10 seconds would I be okay, and the alarm would not trigger at all?

I like the idea of putting a 10 second delay on the buzzer if the reed switch opens, since the reed switch will close before that 10 second time frame expires, but what happens when the product passes by the IR Sensor roughly 2 seconds into that 10 second delay? Does the alarm sound because the IR just triggered? Or does the 10 second delay still remain and as long as both sensors (reed and IR) return to normal before the 10 seconds expire would I be all good?

If I would be all good with this suggestion would you mind actually telling me what the lines of code for this would be? I apologize, but I've never done this code thing before.