Can I get coupons to be a 1 use per user?

I would like to have coupons available for users for one lifetime use per user. Example: User gets to use the coupon when they first sign up for a subscription but after that cannot use it again. AND I do not want to have to manually create a new coupon code for each user as I have over 16,000 possible users.

  • aecnu
    • WP Unicorn

    Greetings golftourney,

    Thanks for bringing this up, it certainly sounds like a useful customization to the plugin.

    Unfortunately, it is not currently available - but we would love to put it into consideration for future development

    I have moved this ticket to the applicable feature requests area and I have alerted the lead developer to the request.

    It might take a bit longer than useful but alternatively, you could see if there's a developer available at wpmu jobs who could get onto it right this minute

    Thank you for being a WPMU DEV Community Member!

    Cheers, Joe

  • Jonathan Potter
    • Site Builder, Child of Zeus

    Golftourney,

    If you're using, say, Gravity Forms to handle user signup (or any solution where you can run PHP upon user signup--Gravity is a great plugin), it's a piece of cake to just dynamically create a one time use coupon. This is really a job for your user registration plugin rather than Marketpress.

    Here's some quickly hacked code from marketpress.php, I haven't tested it, but you can always find the original at line 5860 and make your own copy.

    $new_coupon_code = 'THISISACOUPON'; //coupon code, you can randomly generate this with rand(1000000, 999999999);
    /*you may want to combine it with some kind of mail function to send it to your user. See http://www.w3schools.com/php/php_mail.asp . Or, you can create the coupon code elsewhere where you can send/show it to the user and just pass it to this script. */
    
              $coupons[$new_coupon_code]['discount'] = 9.99; //This is the discount amount, a PHP float
    
              $coupons[$new_coupon_code]['discount_type'] = 'amt'; //Make this 'amt' for a flat out amount, or 'pct' for percent
    
              $coupons[$new_coupon_code]['start'] = strtotime('2013-06-10'); //YYYY-MM-DD format
    
              $coupons[$new_coupon_code]['end'] = strtotime('2013-06-10'); // Optional, YYYY-MM-DD format, make sure it's after 'start'. 
    
              $coupons[$new_coupon_code]['uses'] = 1; //Optional, this sets the code to a single use.
    
                update_option('mp_coupons', $coupons);
                $new_coupon_code = '';

    Hope that's helpful!

  • Barry
    • DEV MAN’s Mascot

    @golftourney - the plugin stores the coupon that was used by a user to sign up for a subscription, so the information is retained in the database. There isn't currently anything to limit coupons to a specific user, or enforce a use once only rule, but I can add it to the features requests to add something in. If I can find a method of doing it before then, I'll post it up but I think it will require changing the plugins code to do so, so wouldn't be an easy update.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.