EXCLUSIVE

John Cena's divorce nightmare has come to an end ... in fact, the two sides have agreed to bury the hatchet ... TMZ has learned.

As we previously reported, Elizabeth Huberdeau felt like she was blindsided when Cena unexpectedly filed to end their 3-year marriage back in May.

Things got nasty ... quickly ... with Liz making moves to challenge the couple's prenup. Liz also said she believed Cena was messing around with other women behind her back.

But now, Liz's attorney, Raymond Rafool, tells TMZ the two have managed to work things out privately ... saying, "All matters [in the divorce] have been settled and resolved amicably.”

The terms of the settlement are confidential.