(a) In all actions for divorce from the bonds of matrimony or legal separation the parties may stipulate as to grounds and/or defenses.
(b) The court may, upon stipulation to or proof of any ground of divorce pursuant to § 36-4-101, grant a divorce to the party who was less at fault or, if either or both parties are entitled to a divorce or if a divorce is to be granted on the grounds of irreconcilable differences, declare the parties to be divorced, rather than awarding a divorce to either party alone.