June 28, 2012 - Comments Off on Drupal 7 Commerce Coupons: Unlimited redemptions

Drupal 7 Commerce Coupons: Unlimited redemptions

The Commerce module and its add-ons are very powerful. The coupon module has recently undergone a major rewrite and its one we're using for one of our sites. In this post we'll talk about making a modification to one of the coupon rules to allow for unlimited coupon redemptions if you enter '0' (zero) in the Number of uses field when editing a coupon.

In Workflow > Rules edit the rule Coupon Validation: Check the number of redemptions.
Add an AND condition
Then, add a Data Comparison condition
For the data to compare choose: coupon:commerce-coupon-number-of-uses
Choose the equals operator, and 0 as the value.
Next, we want to negate this condition. See the post on Drupal Rule(s)! for an explanation of this option.
Lastly, save the new condition and drag it and the Entity has field condition under the And operator.

Coupon conditions

Coupon conditions

That's it. Now you can redeem a coupon as many times as you want.

Drupal's well thought-out and structured framework allows for changes to functionality to be done at a high level instead of always needing to dig into code and/or write Tarzan-like, custom PHP. This in turn, saves other developers and designers a lot of time. Thanks Drupal!

Links:

Published by: chazcheadle in The Programming Mechanism
Tags: , ,

Comments are closed.