How to Integrate Birthday Coupon in WooCommerce

woocommerce birthday discount coupon

 Ever wondered how to make your customers feel truly special on their birthdays while also driving repeat business? In today’s competitive market, maintaining customer loyalty and engagement is crucial for any business. One effective strategy is giving away a discount on customers’ birthdays to make them feel special and valued. This not only shows your appreciation but also encourages them to return to your store. Let’s explore how to integrate birthday coupons in WooCommerce to delight your customers and boost your sales.

Integrate WooCommerce Discount Coupon – Methods

There are two methods that can be used to integrate WooCommerce Discount Coupons into your store, which are discussed in detail below: 

  1. WooCommerce Birthday Discount Coupon by KoalaApps
  2. Adding WooCommerce Discount Coupon Programmatically

Method #1: WooCommerce Birthday Discount Coupon by KoalaApps

The WooCommerce Birthday Discount Coupon by KoalaApps is a great tool to automate the process of collecting birthdates and sending personalized birthday discounts to customers. You can add a custom field on the registration, checkout, or My Account page. This plugin allows you to customize the birthday email text and schedule emails sent to customers. You also get the flexibility to apply discounts to certain products or categories and select user roles to restrict who receives birthday emails. 

Let’s dive into how you can install, set up, and make the most out of this plugin.

Installation

To install the WooCommerce Age Verification Popup plugin, follow these steps:

  • To install this plugin, search the .zip file from your WooCommerce account and begin downloading.
  • Go to the WordPress Admin Panel. Select Plugins, choose Add New, and then choose the file to Upload Plugin.
  • Select Install Now and then click Activate.

Setup and Configuration

After activation, you’ll find a new tab in WooCommerce > Settings labeled Birthday Discount Coupon. Click on this tab to begin configuring the plugin. 

Enable the Plugin

Check the box to activate the birthday discount feature in your store.

Collect Birthdates from Your Customers

In order to send automatic birthday emails to your customers, you first need to add the custom DOB field into your Registration, Checkout, and My Account pages.

  • Add a date of birth field to your registration page.
  • Similarly, add a date of birth field to your checkout page.
  • Set days before birthday to send coupon to Customer (Entering “0” indicates you can send it on the same day).
  • Enter a custom DOB field label.
  • Mark the fields mandatory or optional.

Customize Discounts and Adjust Purchase Limits

Types of Discounts:

The plugin offers several discount types to suit different business needs:

  • Percentage Discount: Offer a discount as a percentage of the total cart value.
  • Fixed Cart Discount: Apply a fixed amount discount to the entire cart.
  • Fixed Product Discount: Apply a fixed amount of discount to specific products.

Setting Discount Amount: 

  • You can specify the discount amount based on the type of discount you’ve chosen.

Coupon Code Customization:

  • Set the desired length of your coupon codes.
  • Add a prefix to your coupon codes for easy identification.

Coupon Validity and Expiry: 

  • Define how many days the coupon will be valid. This can help create a sense of urgency and encourage quick purchases.
  • Enter the desired format for the coupon expiry date. 

Purchase Limits: 

  • Set minimum and maximum purchase amounts required to apply the discount.
  • Enable free shipping if the coupon allows it to add extra value for your customers.
  • Check this box if you don’t want the discount to apply to items that are already on sale. Checkmark the option “Excluding Sale Items.”

Set Restrictions for Certain Products/Categories & User Roles

Applying Discounts to Specific Products & Categories: 

  • Select the products to which the discount will apply. This is useful for promoting specific items.
  • You can also exclude certain products and categories from the discount to protect your margins on high-demand items.

User Role Restrictions:

  • Select which user roles can avail the discount. This is particularly useful for segmenting your customer base.

Coupon Usage Restrictions:

  • Ensure that the email address linked to the customer’s account is used to apply the discount to prevent misuse of the coupon codes.

Customize & Schedule Birthday Emails

  • Enter the admin email address where you’d like to receive notifications.
  • Specify the name that will appear as the sender of the birthday emails.
  • Write compelling email subjects and body content to capture your customer’s attention and make them feel special on their birthdays.

Scheduling Birthday Emails:

  • Determine the days before the birthday when the coupon should be sent. Enter “0” to send it on the same day.
  • Configure the plugin to automatically send out the birthday emails as per the schedule you’ve set to ensure that no customer has been missed.

Method #2: Adding WooCommerce Discount Coupon Programmatically

Implementing WooCommerce Birthday Coupon to your store is easy and can be carried out using the program highlighted below: 

Add the following code in functions.php file of your active or child theme to create new custom endpoints for your my account page.

unction generate_birthday_coupon($user_id) {
$user_info = get_userdata($user_id);
$birth_date = get_user_meta($user_id, ‘birth_date’, true);

// Ensure the birth date is in the correct format (YYYY-MM-DD)
if ($birth_date && date('m-d') == date('m-d', strtotime($birth_date))) {
    $coupon_code = 'BIRTHDAY-' . strtoupper(wp_generate_password(8, false));

    $coupon = array(
        'post_title' => $coupon_code,
        'post_content' => '',
        'post_excerpt' => 'Birthday discount coupon',
        'post_status' => 'publish',
        'post_author' => 1,
        'post_type' => 'shop_coupon'
    );

    $new_coupon_id = wp_insert_post($coupon);

    // Add meta data for the coupon
    update_post_meta($new_coupon_id, 'discount_type', 'percent');
    update_post_meta($new_coupon_id, 'coupon_amount', '10'); // 10% discount
    update_post_meta($new_coupon_id, 'individual_use', 'yes');
    update_post_meta($new_coupon_id, 'usage_limit', '1');
    update_post_meta($new_coupon_id, 'expiry_date', date('Y-m-d', strtotime('+7 days')));

    // Email the coupon to the user
    $to = $user_info->user_email;
    $subject = 'Happy Birthday! Enjoy Your Discount Coupon';
    $message = 'Dear ' . $user_info->first_name . ',\n\nHappy Birthday! As a special gift, we are giving you a 10% discount on your next purchase. Use the following coupon code during checkout:\n\n' . $coupon_code . '\n\nThe coupon is valid for the next 7 days.\n\nBest regards,\nYour Company Name';
    $headers = array('Content-Type: text/plain; charset=UTF-8');

    wp_mail($to, $subject, $message, $headers);
}

}

// Hook into user login to check for birthday and generate coupon
add_action(‘wp_login’, function($user_login, $user) {
generate_birthday_coupon($user->ID);
}, 10, 2);

// Add a custom field for the user’s birth date during registration
add_action(‘woocommerce_edit_account_form’, function() {
$user_id = get_current_user_id();
$birth_date = get_user_meta($user_id, ‘birth_date’, true);
?>
<?php
});

// Save the custom field during registration
add_action(‘woocommerce_save_account_details’, function($user_id) {
if (isset($_POST[‘birth_date’])) {
update_user_meta($user_id, ‘birth_date’, sanitize_text_field($_POST[‘birth_date’]));
}
});

Contribute to your Customers’ Birthday Today!

In conclusion, the features of the WooCommerce Birthday Coupon plugin make it easy to create a targeted, effective birthday discount campaign that makes your customers feel special on their birthdays.

It adds a personal touch that shows you value them not just as customers but as individuals. This gesture of goodwill can brighten their day, making them feel appreciated and remembered by your business. 

Sending birthday coupons is a thoughtful way to celebrate your customers’ birthdays. It strengthens your relationship with them and fosters a sense of loyalty that can lead to long-term business success.

Sign up to get Latest Updates

For more digital insights, sign up for the latest updates and industry news right in your inbox.