Title: Second Purchase Attribution Code
Last modified: August 22, 2016

---

# Second Purchase Attribution Code

 *  Resolved [John Turner](https://wordpress.org/support/users/johnnytee/)
 * (@johnnytee)
 * [11 years, 7 months ago](https://wordpress.org/support/topic/second-purchase-attribution-code/)
 * Here’s some code that will attribute all purchase after the 1st to the user:
 * [https://gist.github.com/seedprod/3702640a82bef7d5ecfe](https://gist.github.com/seedprod/3702640a82bef7d5ecfe)
 * [https://wordpress.org/plugins/edd-auto-register/](https://wordpress.org/plugins/edd-auto-register/)

Viewing 5 replies - 1 through 5 (of 5 total)

 *  [smashballoon](https://wordpress.org/support/users/smashballoon/)
 * (@smashballoon)
 * [11 years, 7 months ago](https://wordpress.org/support/topic/second-purchase-attribution-code/#post-5380697)
 * Hey JT,
 * This is awesome and exactly what I need! 🙂 Just to clarify, if a user comes 
   back to the site having purchased before but isn’t logged in then this will attribute
   their new purchase to them rather than attributing it to ‘guest’, is that correct?
 * Thanks so much for posting this!
 * John
 *  Thread Starter [John Turner](https://wordpress.org/support/users/johnnytee/)
 * (@johnnytee)
 * [11 years, 7 months ago](https://wordpress.org/support/topic/second-purchase-attribution-code/#post-5380698)
 * Yep, it works in all my testing. I haven’t had an issue yet, but my site is not
   in production yet either.
 *  [smashballoon](https://wordpress.org/support/users/smashballoon/)
 * (@smashballoon)
 * [11 years, 7 months ago](https://wordpress.org/support/topic/second-purchase-attribution-code/#post-5380702)
 * Awesome, I’ll try it out. Thanks again for sharing!
 *  [danhowden](https://wordpress.org/support/users/danhowden/)
 * (@danhowden)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/second-purchase-attribution-code/#post-5380773)
 * Hi John,
 * Thanks a lot for this…very kind.
 * Please can you elaborate on where this code should be placed? Which file do I
   edit?
 *  Thread Starter [John Turner](https://wordpress.org/support/users/johnnytee/)
 * (@johnnytee)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/second-purchase-attribution-code/#post-5380774)
 * So I would create a new plugin so you don’t break updates on this plugin. Then
   instead of referencing the class like in the gist just reference the function
   in your plugin.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Second Purchase Attribution Code’ is closed to new replies.

 * ![](https://ps.w.org/edd-auto-register/assets/icon-256x256.png?rev=2718121)
 * [EDD Auto Register](https://wordpress.org/plugins/edd-auto-register/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/edd-auto-register/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/edd-auto-register/)
 * [Active Topics](https://wordpress.org/support/plugin/edd-auto-register/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/edd-auto-register/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/edd-auto-register/reviews/)

 * 5 replies
 * 3 participants
 * Last reply from: [John Turner](https://wordpress.org/support/users/johnnytee/)
 * Last activity: [11 years, 6 months ago](https://wordpress.org/support/topic/second-purchase-attribution-code/#post-5380774)
 * Status: resolved