How to limit coupon code usage for guest user in Magento ?

Magento Shopping cart price rules provide the ability to limit the coupon usage for customers. But however, a Not Logged In User/Guest can use the same coupon code multiple times and get a discount. This seems to be a core bug and Magento doesn’t provide any restriction for guest users. In this article we will discuss on how to limit coupon code for guest user in Magento

The Common Problem of identifying the guest user:

Current Problem when it comes to restricting the coupon usage for Guest is we don’t know the identity of the guest unless he/she logs in to the Magento portal. To overcome this limitation we can shift the coupon box from “cart” page to “one-page” checkout and add a custom code to validate the coupon code usage for guest user. By moving the coupon box to “one-page” checkout section we can get the email id of the guest user in the billing address section.

Possible Solutions:

For placing the discount box in the checkout there are several free Magento extension available in Magento connect. we can use any one of them which suits our needs.For this example, i use the below extension which moves the coupon code to checkout step.
Next step is to add our custom module to restrict the guest coupon usage. Please find the sample code snippet of the observer class which will get executed whenever a sales rule is applied to the cart.

The complete module is available in the below GitHub link