A commonly-used provision is RCW 4.84, specifically 4.84.250, but that provision is only for cases involving claims of $10K or lower. Links are attached after the end of this answer.
Another provision in Superior Court cases is Civil Rule 68, but the "costs" referred to in that rule don't include more than nominal attorney fees.
In mandatory arbitration cases (up to $50K), a party dissatisfied with the arbitration result can proceed to trial, and if the party fails to improve his/her position over the arbitration result, the party must pay the other side's attorney fees.
Many contracts and some statutes for special types of cases (consumer protection, landlord tenant, antitrust, for example) contain fee-award clauses, and offers of settlement can be made in conjunction with such clauses.
Shifting litigation costs and attorney fees to opposing parties is a tricky business. Fee shifting is supposed to reduce litigation by giving parties incentives to settle weak claims rather than risk having to pay the other side's lawyer fees, but litigation is often made worse by fee shifting. Some litigation (maybe most litigation) is driven purely by the attorney fees. If you are trying to either invoke fee-shifting or avoid it, you'll need a lawyer to sort it out.
This answer is intended as a courtesy only, and does not constitute an attorney-client relationship between the attorney and the questioner.
I agree with Mr. Stimmel and the offer to settle in writing according to the statute can shift the fees, but will also often result in further litigation and a motion to reconsider and further entrench parties.
If this answer was helpful, please mark as helpful below. Please be sure to indicate the best answer Only If and until you and I sign an Agreement for Legal Services, I am not your attorney. These answers are provided for informational and/or novelty purposes