Discount code = free order = bug

Any idea guys on how I could achieve this ?