I'm working on a project where the need is to let users purchase a coupon with a single code that can be redeemed multiple times. A single coupon is desirable so that one person in an organization can distribute that single coupon to a group of people, without having to allocate specific codes to specific people.

I believe I'll need to offer a patch to make this possible, but wanted to check here first in case there's some way to do this with the "bulk" option.

Thanks!

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ezra-g’s picture

Status: Active » Needs review
FileSize
967 bytes

This patch checks the base coupon's bulk status, and creates either a single coupon code or bulk coupon codes accordingly.

ezra-g’s picture

The previous patch created coupons with max usage 0 when bulk wasn't set.

wodenx’s picture

Status: Needs review » Needs work

I like the idea of this patch (being able to purchase a fixed number of uses for a single code), but I don't like that the max_uses field in the base coupon is ignored, and I am also concerned that this implementation may break existing setups (which very well might assume that separate codes will be generated for all purchases where $qty>1).

I'd say that the quantity should be multiplied by the max_uses in the base coupon. And also that there should probably be a separate coupon_purchase flag determining whether $qty>1 generates multiple codes or multiple uses - this could be added in uc_coupon_purchase_uc_coupon_add_form_alter().