A way to attract the new customers is by incentivising their first purchase. E.g. Providing a discount, taking off the shipping charges, providing an extra product for free, etc.
In a recent commerce project we had a this requirement to find out if the purchase being made is the user's first. Searching for a solution online, I came across this sandbox module. The module needed to be published on drupal.org with a little cleanup (code structure and coding standards)  . It was promoted to full project : Commerce First Time Customer Discount.
The module provides a couple of ways to identify if the purchase being made by the customer is his/her first:
- Using inline condition
- Using rules condition
Using inline condition:
Commerce First time Customer Discount can be easily integrated with the Commerce Discount module to check if the purchase is the user’s first. Follow the steps given below to implement it:
- Install commerce discount module.
- Install Commerce First Time Customer Discount module.
- Go to “Store settings” >> “Discounts”(admin/commerce/store/discounts) and click “Add discount”.
- Fill in the details for the fields “Admin title”, “Name”, choose the “Discount Type”
- Under “Order discount conditions” select “First Time Customer”. The Commerce First Time Customer Discount module provides this option.
- Choose the offer type of your choice.
Your new offer will be now applied to the first purchase that a customer makes. Using commerce discount also enables you to set a date during which this offer will be applicable.
Using rules condition:
Commerce First Time Customer Discount module provides a rule condition to check if this is the first purchase made by the customer. Follow the steps given below to implement discount using the rules module:
- Install the Commerce First Time Customer Discount module.
- From rules admin section (admin/config/workflow/rules), click to “Add new rule” button. Note: You will have to enable to rules_admin module for this.
- Select any event in the “Commerce Order” section. Ex. Before saving a new order.
- Add a condition “Users First Order” under the “Commerce Order” section.
- Add any action of your choice to the order. The action could be to apply a discount, give away a free product, provide free shipping, etc.