easydigitaldownloads/Easy-Digital-Downloads — pull request #2791 by lukechilds (2014-11-17 18:01:27+00:00)
Title: Make sure discount code exists before trying to apply it

Checks that the discount code exists before trying to apply it, otherwise `edd_get_discounted_amount()` will return `0`.

When this is then subtracted from `$price` and inverted to make `$discounted_price` here:

`$discounted_price -= $price - edd_get_discounted_amount( $discount, $price );`

it'll always equal the negative value of the price giving the user a 100% discount.