Max M. answered 03/10/17
Tutor
5.0
(336)
Harvard Literature major with 20 years of coaching writers
In this case, the comma goes before "then," because there are two separate clauses and the comma is basically replacing the word "and." If the word "and" were written, comma use would be a matter of taste.
An imperfect but still useful way to think about commas is to imagine saying the sentence out loud, and if you would pause slightly, a comma might go there. In this case, that would have at least helped you eliminate the "comma after then" possibility.