Only downcase coupon code when it exists

Fixes #4515