Part of the Commerce ecosystem · 487 projects
This module adds a promotion condition to Drupal Commerce that allows you to target customers based on their past order history. You can set conditions like rewarding customers who have placed a certain number of orders, spent a minimum amount, or whose previous orders fall within a specific timeframe. This is useful for creating loyalty programs and offering special discounts to returning customers.
Commerce Loyalty Condition adds a promotion condition that looks at the customer's own order history instead of the order in front of them, so a store can reward returning customers without coupons or custom code: a discount from the fourth order onwards, free shipping for anyone who has spent over a threshold this year, an offer for customers who bought recently.
Features
- ๐ Rewards by order count. The condition matches customers who already have at least the number of completed orders you set, so the reward starts on the next order. Carts and other drafts are never counted.
- โฐ A time window. Count only the orders completed in the last N days, to reward customers who bought recently; leave it empty to count the customer's whole history.
- ๐ฐ A minimum spent. Require the counted orders to add up to at least an amount, in the currency you pick. An amount equal to the minimum passes.
- โ๏ธ Configured on the promotion form. The condition is called Limit by number of orders and sits under the Customer tab of a promotion's conditions, next to Commerce's own, so it combines with them, with coupons and with usage limits. It is offered on payment gateways too, wherever Commerce takes conditions on an order.
- ๐ Guests never match. Every guest checkout belongs to the same anonymous account, so the condition only matches customers with an account of their own and never hands a first time visitor the history of everyone who checked out as a guest.
Quick start
composer require drupal/commerce_loyalty_condition drush en commerce_loyalty_condition
- Go to Commerce > Promotions and add or edit a promotion.
- Under Conditions, open the Customer tab and tick Limit by number of orders.
- Fill in Customer's quantity of completed orders, and optionally the number of days to look back and Customer's minimum total purchases sum, then save.
- Log in as a customer with enough completed orders and add a product to the cart: the promotion's line appears in the order summary.
The cart of a customer with three completed orders in the last year, adding up to 196.00 EUR.
Good to know
- An order counts once it reaches the Completed state, and the time window is measured from that moment. In a workflow with fulfillment, an order placed but not yet fulfilled does not count.
- Orders are counted in every store and of every order type the customer has.
- Orders in a currency other than the minimum's are left out of the sum, because the module holds no exchange rates. They still count towards the number of orders.
- The condition is evaluated on every cart refresh, with one query for the count and, when a minimum is set, one load of the counted orders.
Additional requirements
- Drupal 10 or 11.
- Commerce Core 2.40 or later, or 3, with its Order module; Promotion for promotions.
Recommended modules/libraries
- Commerce Mautic Connect: sends each customer's number of orders and total spent to Mautic, so a campaign can tell returning customers about the offer this condition gives them.
Community documentation
- README: the three settings, how the condition decides, and the supported versions.
Supporting this module
Developed and maintained by Bloomidea. Bloomidea offers support and custom development for this module.
Ask your assistant about Commerce Loyalty Condition
Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works
Depends on
Dependencies of the latest stable release
- Commerce Core commerce_order
Required by
Tracked projects that depend on this one
No tracked projects depend on this one yet.
More in the Commerce ecosystem
Most installed first