Upgrade Your Drupal Skills

We trained 1,000+ Drupal Developers over the last decade.

See Advanced Courses NAH, I know Enough

First Time Customer Discount using Drupal Commerce

Parent Feed: 

E-commerce has become a way of life for most of us and with so many ecommerce portals competing it becomes important to attract new customers to your site.

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) [1] [2]. 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:

  1. Using inline condition
  2. 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:

  1. Install commerce discount module.
  2. Install Commerce First Time Customer Discount module.
  3. Go to “Store settings” >> “Discounts”(admin/commerce/store/discounts) and click “Add discount”.
  4. Fill in the details for the fields “Admin title”, “Name”, choose the “Discount Type”
  5. Under “Order discount conditions” select “First Time Customer”. The Commerce First Time Customer Discount module provides this option.
  6. Choose the offer type of your choice.
  7. Save!

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:

  1. Install the Commerce First Time Customer Discount module.
  2. 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.
  3. Select any event in the “Commerce Order” section. Ex. Before saving a new order.
  4. Add a condition “Users First Order” under the “Commerce Order” section.
  5. 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.
  • [1] : Github issue for proposing the promotion of the module.
  • [2] : drupal.org issue for promoting the sandbox to full project.
Author: 
Original Post: 

About Drupal Sun

Drupal Sun is an Evolving Web project. It allows you to:

  • Do full-text search on all the articles in Drupal Planet (thanks to Apache Solr)
  • Facet based on tags, author, or feed
  • Flip through articles quickly (with j/k or arrow keys) to find what you're interested in
  • View the entire article text inline, or in the context of the site where it was created

See the blog post at Evolving Web

Evolving Web