Update: This is now a feature that’s built directly into the Software Licensing add-on for Easy Digital Downloads. It can be accessed in Downloads > Settings > Extensions > Software Licensing. From there check the box for “Disable Discount Codes on Renewals”.

Recently I had a question about Easy Digital Downloads – Software Licensing that I hadn’t thought about before. When offering a renewal discount, how can we prevent any additional discounts from being applied to the cart? You see, depending on the discount code someone has, you could be losing money if you offer a discount to renew a license, and then a discount code is used on top of that.

So here’s the quick snippet, and what it looks like on the front end:

function kfg_check_if_is_renewal( $return ) {

	if ( EDD()->session->get( 'edd_is_renewal' ) ) {
		edd_set_error( 'edd-discount-error', __( 'This discount is not valid with renewals.', 'edd' ) );
		return false;
	}

	return $return;

}
add_filter( 'edd_is_discount_valid', 'kfg_check_if_is_renewal', 99, 1 );

Then if a customer tries to apply a discount code, with a renewal, they’ll see the following:
Screen Shot 2015-04-07 at 11.04.01 PM

If you would like a single-file plugin for this, you can get it from the EDD Library.

Posted by Chris Klosowski

Chris Klosowski is the Director of Technology at Sandhills Development, LLC, creators of fine WordPress plugins, and ecommerce solutions.

29 Comments

  1. Unquestionably believe that which you said. Your favorite reason seemed to be on the internet
    the simplest thing to be aware of. I say to you,
    I definitely get irked while people consider worries
    that they just do not know about. You managed
    to hit the nail upon the top and defined out the whole thing without having side
    effect , people could take a signal. Will probably be back to get more.
    Thanks

    Reply

  2. It’s fantastic that you are getting ideas from this post as well as from our
    dialogue made at this place.

    My blog post – mpc-install.com

    Reply

  3. Real great visual appeal on this internet site, I’d value it 10.

    Here is my page … https://kebe.top/

    Reply

  4. When I originally commented I clicked the “Notify me when new comments are added” checkbox and now each time a comment is added I
    get four e-mails with the same comment. Is there any way you can remove people from that
    service? Thanks a lot!

    Also visit my web site 918kiss 2 slot game

    Reply

  5. Thanks on your marvelous posting! I actually enjoyed reading it, you are a great author.

    I will remember to bookmark your blog and may come back in the foreseeable future.
    I want to encourage you continue your great posts, have a nice morning!

    Visit my site; http://www.craksracing.com/

    Reply

  6. I wanted to check up and let you know how considerably I valued discovering your web site today.

    We would consider it the honor to operate at my
    business office and be able to use the tips shared on your site and also
    be a part of visitors’ opinions like this. Should a position associated with guest
    author become on offer at your end, you should let me know.

    My web page :: kebe.top

    Reply

  7. I and my pals happened to be checking out the excellent helpful tips on your site while the sudden I got a terrible feeling I never
    expressed respect to the site owner for them.
    All of the people are already absolutely happy to learn all of them and have actually been enjoying these things.
    We appreciate you getting quite helpful and also for using this kind of nice issues millions of individuals are really needing to understand about.
    My very own sincere regret for not expressing gratitude to
    earlier.

    my web site :: http://www.craksracing.com

    Reply

  8. Its such as you read my mind! You seem to know a lot
    approximately this, such as you wrote the book
    in it or something. I think that you simply could do
    with a few percent to power the message home a
    bit, but other than that, this is fantastic blog.
    A fantastic read. I will definitely be back.

    Reply

  9. Wow, wonderful blog layout! How long have you been blogging
    for? you make blogging look easy. The overall look
    of your site is fantastic, let alone the content!

    Reply

  10. Excellent weblog right here! Also your site lots up very fast!
    What host are you the usage of? Can I get your associate hyperlink to your host?
    I want my web site loaded up as quickly as yours lol.

    Feel free to visit my website: Keto Premium Shot Reviews

    Reply

  11. I regard something truly interesting about your web site so
    I bookmarked.

    Review my web blog :: Kodo Detox Patch

    Reply

  12. I don’t even know how I ended up here, but
    I thought this post was good. I do not know who you are but certainly you are
    going to a famous blogger if you aren’t already 😉 Cheers!

    Reply

  13. I know this if off topic but I’m looking into starting my own weblog and was curious what all is needed to get set
    up? I’m assuming having a blog like yours would
    cost a pretty penny? I’m not very internet savvy so I’m not 100% sure.
    Any suggestions or advice would be greatly appreciated. Thanks

    Reply

  14. I’m extremely impressed with your writing skills and also with the layout on your weblog.
    Is this a paid theme or did you modify it yourself? Either way keep up the nice
    quality writing, it’s rare to see a great blog
    like this one nowadays.

    Reply

  15. Some genuinely interesting details you have written.Aided me a lot, just
    what I was looking for :D.

    Here is my page … Electro Hard

    Reply

  16. I value the blog article.Thanks Again. Much obliged.

    Reply

  17. Have you ever considered publishing an ebook or guest authoring
    on other sites? I have a blog centered on the same topics you discuss and would really like to have you share
    some stories/information. I know my readers would value your work.
    If you’re even remotely interested, feel free to shoot me an e mail.

    Reply

  18. Magnificent goods from you, man. I have understand your stuff previous to and you are just extremely great. I really like what you have acquired here, really like what you’re stating and the way in which you say it. You make it enjoyable and you still care for to keep it smart. I can not wait to read much more from you. This is really a tremendous website.
    energylandia

    Reply

  19. Thank you for the visit, thank you also have provided the information we really need, do not forget to share information and visit our page thank you. blockchain

    Reply

  20. chdap viagra viagra cheap cheapest – bolton viagra

    Reply

  21. prednisone without prescription 10mg prednisone pills – pharmacy cost of prednisone

    Reply

  22. stromectol 3 mg ivermectin for sale humans – stromectol covid

    Reply

  23. ivermectin human generic stromectol – buy stromectol

    Reply

  24. best male ed pills prescription drugs without doctor approval – buy prescription drugs without doctor

    Reply

  25. online medications natural ed remedies – medication for ed dysfunction

    Reply

  26. plaquenil 100 plaquenil for sale canada – plaquenil order online

    Reply

  27. order stromectol buy stromectol – ivermectin 18mg

    Reply

  28. clomid 50mg clomid for sale – clomid canada

    Reply

Leave a reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.