Award Bonus Points on a Customer’s First Order

The plugin awards points for every order, but it has no built-in bonus for a customer’s first order. This snippet adds one: a registered customer receives 50 extra points, once, when their first order becomes Processing or Completed. This works in both Points and Rewards for WooCommerce and Loyalty Program for WooCommerce.

The Snippet

Add the snippet to your theme’s functions.php or a code snippets plugin.

add_action('woocommerce_order_status_changed', function ($order_id) {
	$first_order_bonus = 50;

	$order = wc_get_order($order_id);
	if (!$order || !in_array($order->get_status(), ['processing', 'completed'], true)) {
		return;
	}

	$user_id = $order->get_user_id();
	if (!$user_id || get_user_meta($user_id, '_wpgl_first_order_bonus_awarded', true)) {
		return;
	}

	// Only the customer's first paid order qualifies.
	$paid_orders = wc_get_orders([
		'customer_id' => $user_id,
		'status'      => ['wc-processing', 'wc-completed'],
		'limit'       => 2,
		'return'      => 'ids',
	]);
	if (count($paid_orders) !== 1 || (int) $paid_orders[0] !== (int) $order_id) {
		return;
	}

	do_action(
		'wpgens_loyalty_update_points',
		$user_id,
		$first_order_bonus,
		WPGL_Points_Activity_Type::EARN,
		WPGL_Points_Source_Type::MANUAL,
		$order_id,
		'First order bonus'
	);

	update_user_meta($user_id, '_wpgl_first_order_bonus_awarded', current_time('mysql'));
}, 20, 1);

How It Works

The bonus is on top of the normal points for the order and appears in the customer’s points history as “First order bonus”. Change the 50 in $first_order_bonus to set a different amount.

Only the customer’s first paid order qualifies. Customers who already had paid orders before you added the snippet do not receive the bonus, and each customer can receive it only once. Guest orders are skipped, because the points need a customer account.

The bonus is not removed automatically if the first order is later cancelled or refunded. Adjust the balance manually in Members if needed.

Browse our plugins

Lightweight WooCommerce plugins built for speed. No bloat, no frameworks -- just clean code that works.

View all plugins
Stay in the loop

Get notified when we launch new plugins. No spam, just product updates.