Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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!
Comment | File | Size | Author |
---|---|---|---|
#2 | uc_coupon_purchase-single-coupon-1076674.patch | 955 bytes | ezra-g |
#1 | uc_coupon-1076674-single.patch | 967 bytes | ezra-g |
Comments
Comment #1
ezra-g CreditAttribution: ezra-g commentedThis patch checks the base coupon's bulk status, and creates either a single coupon code or bulk coupon codes accordingly.
Comment #2
ezra-g CreditAttribution: ezra-g commentedThe previous patch created coupons with max usage 0 when bulk wasn't set.
Comment #3
wodenx CreditAttribution: wodenx commentedI 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().