Add ‘usage_limit_per_user’ option

Hi guys,

We’re trying to use Affiliates Coupons to generate a coupon for our affiliates that they can give out to potential customers. We want the coupons to be used an infinite amount of time, but only once per user.

We’ve tried to add it but the option is not saving the value.

Could you assist us in adding this option?

Thank you!

Kind regards,
B

11 Responses to Add ‘usage_limit_per_user’ option

  1. Bastien March 22, 2016 at 1:47 pm #

    Hello Antonio,

    Thank you for this information. While that’s an interesting mod it doesn’t answer my concern.

    Will a customer be able to use every affiliate coupons? So they can get as many 10$ discounts as there are affiliates?

    Is there a way to make sure once a customer uses one affiliate coupon it renders all affiliate coupons null?

    The purpose of the affiliate coupon is to give a tool for affiliates to make it easier to generate leads in person by giving out a discount to their prospect. Customers have to create an account, so as soon as they will make their first order, they will be linked to their referring affiliate and at this point, we don’t want any other affiliate coupon to be effective since the association will be already made.

    This is a major drawback from affiliate coupon and I’d like us to find a solution to this.

    Thank you!

    Regards,
    B

    • antonio March 23, 2016 at 8:55 am #

      Hi Bastien,
      Change the title is to prevent users find out the coupon codes.
      You can use the ‘woocommerce_coupon_is_valid’ woocommerce filter to limit the use and create your own solution.
      Kind Regards,
      Antonio B.

  2. Bastien March 21, 2016 at 9:55 pm #

    Edit : My last sentence wouldn’t work. We can’t just check if the customer is linked to an affiliate or not. The customer might have just registered through an affiliate link and is doing his first order when applying the coupon. There has to be some way to prevent customers from using every affiliates coupon…

    • antonio March 22, 2016 at 11:42 am #

      Hi Bastien,
      You could change the coupons code using ex. the affiliate’s username instead of the affiliate_id.
      Changing:
      $coupon_title = $coupon_prefix . $affiliate_id;
      in affiliates-coupons/lib/comp/class-affiliates-coupons-woocommerce.php line 221 for bulk coupons.
      Kind Regards,
      Antonio B.

  3. Bastien March 21, 2016 at 9:52 pm #

    Antonio,

    I was wondering something about Affiliates Coupon…

    Let’s say we have 100 affiliate with each their own coupon, AFF1 to AFF100.

    Each coupons can be used an infinite amount of time, but only one time per user.

    A customer uses one of the coupon, gets a rebate and is linked to the corresponding affiliate.

    Would the customer be able to use every affiliate coupons once? I’m guessing it would not change the original referring affiliate if the user has been permanently associated to an affiliate previously, right?

    Now would it be possible to prevent a customer to use any affiliate coupon once they have used one and are being linked to an affiliate?

    Basically, can we make a check that if the customer is linked to an affiliate, the coupon would not be applied?

    Kind regards,
    B

  4. Bastien March 21, 2016 at 3:44 pm #

    PS : Just noticed that was the exact file you pointed to. The “-admin” file adds the options in the admin panel. Thanks for the hint!

    • antonio March 21, 2016 at 4:22 pm #

      Thanks you very much Bastien !!!

  5. Bastien March 21, 2016 at 3:42 pm #

    Hello Antonio,

    Modifications worked like a charm! I had to also edit the file “class-affiliates-coupons-woocommerce.php” in order to update the coupons meta.

    I also covered the bulk coupon creation tool.

    Files :
    https://www.dropbox.com/s/7xqd1vcuy97dymd/class-affiliates-coupons-admin.php?dl=0
    https://www.dropbox.com/s/xr1tml3a2rnqyjp/class-affiliates-coupons-woocommerce.php?dl=0

    Would appreciate if you could have a look and add that to future versions!

    Kind regards,
    B

  6. antonio March 21, 2016 at 3:07 pm #

    Hi Bastien,
    This option is not available. You should customize your plugin, ex. adding in affiliates-coupons/lib/comp/class-affiliates-coupons-woocommerce.php in line 242:
    update_post_meta( $coupon_id, 'usage_limit_per_user', 1 );
    This change the option when you use the bulk coupons action.
    But it’s not the best practice beacuse when you update the plugin, the changes will be lost.
    Kind Regards,
    Antonio B.

  7. Bastien March 21, 2016 at 3:06 pm #

    Hi guys,

    I think I sorted this out. I’m currently testing the modified code.

    Here’s the modded file : https://www.dropbox.com/s/7xqd1vcuy97dymd/class-affiliates-coupons-admin.php?dl=0

    Will report back in a few minutes.

    Regards,
    B

    • antonio March 21, 2016 at 3:09 pm #

      Thanks Bastien !!!

We use cookies to optimize your experience on our site and assume you're OK with that if you stay.
OK, hide this message.

Affiliates · Contact · Jobs · Terms & Conditions · Privacy Policy · Documentation · Downloads · Useful Plugins · My Account

Share