Answers.Body: <p>I tested deleting a discount code with CiviCRM 5.2.1 and CiviDiscount 3.4</p>
  
  <p>When deleting a discount code I saw this warning:</p>
  
  <p>WARNING: Deleting this discount code (GMC610) will prevent users who have this code to avail of this discount. Do you want to continue?</p>
  
  <p>After I deleted the code I searched for the contact id in the "cividiscount_track" table and the item was still there. However, it appears the code was removed from the "cividiscount_item" table as would be expected. So, it appears the code is removed from the list but the tracking data remains in the database.</p>
  
  <p>I checked the Contributions in the contact record of the contributor before and after and I did not notice any changes.</p>
  
  <p>It looks like the only thing that is removed in the contact record is on the 'Codes Redeemed' tab, you will no longer see the code in the CODE column. However you do see the date so you will know some type of code was redeemed.</p>
  
  <p>In summary, it seems safe to delete discount codes as long as you don't mind losing the record of which code was used by a contact.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-08-06T19:19:11.320Z
Answers.Text: Doesn't CiviCRM add the name of the code to the line item being purchased when the code is applied? I imagine this could still be searched for?
Answers.UserDisplayName: Zachary
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-07-12T19:38:41.167Z
Answers.LastActivityDate: 2018-07-12T19:38:41.167Z
Answers.UserDisplayName: CMM Administrator
Body: <p>We've got a fairly long list of discount codes piling up. Many of them are specific to old events and are no longer used. Can I just delete them without affecting other data in the database?</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-09-20T21:21:05.337Z
Comments.Text: do you have a backup / dev site you can test and report back?
Comments.UserDisplayName: petednz - fuzion
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-05-03T16:45:47.853Z
Comments.Text: Did you ever figure this out?
Comments.UserDisplayName: guyiac
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-05-06T09:55:20.940Z
Comments.Text: Sadly no. Got pushed on to the back burner, but still keen to hear of others' experience with this.
Comments.UserDisplayName: Graham
Tags: <cividiscount>
Title: Can I remove old discount codes without affecting contribution records?
ThreadText: # Can I remove old discount codes without affecting contribution records?
  
  (Asked by: username_0 on 2017-09-20)
  
  We've got a fairly long list of discount codes piling up. Many of them are specific to old events and are no longer used. Can I just delete them without affecting other data in the database?
  
  **Tags:** cividiscount
  
  > **Comments:**
  > **username_1**: do you have a backup / dev site you can test and report back?  
  > **username_2**: Did you ever figure this out?  
  > **username_0**: Sadly no. Got pushed on to the back burner, but still keen to hear of others' experience with this.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_3 on 2018-07-12. Score: 3 | Accepted answer
  
  I tested deleting a discount code with CiviCRM 5.2.1 and CiviDiscount 3.4
  
  When deleting a discount code I saw this warning:
  
  WARNING: Deleting this discount code (GMC610) will prevent users who have this code to avail of this discount. Do you want to continue?
  
  After I deleted the code I searched for the contact id in the "cividiscount\_track" table and the item was still there. However, it appears the code was removed from the "cividiscount\_item" table as would be expected. So, it appears the code is removed from the list but the tracking data remains in the database.
  
  I checked the Contributions in the contact record of the contributor before and after and I did not notice any changes.
  
  It looks like the only thing that is removed in the contact record is on the 'Codes Redeemed' tab, you will no longer see the code in the CODE column. However you do see the date so you will know some type of code was redeemed.
  
  In summary, it seems safe to delete discount codes as long as you don't mind losing the record of which code was used by a contact.
  
  > **Comments:**
  > **username_4**: Doesn't CiviCRM add the name of the code to the line item being purchased when the code is applied? I imagine this could still be searched for?  
  
  ---
  
  