Family Code §3042 and Evidence Code §765 cover the preference of the child, and the child as a witness. As you will see when you read it there is no firm rule, in fact there are factors the court will look at. Sufficient age and capacity are the factors the court will look at along with the child’s sincerity and maturity.
Subsection (c) states, “If the child is 14 years of age or older and wishes to address the court regarding custody or visitation, the child shall be permitted to do so, unless the court determines that doing so is not in the child's best interests. In that case, the court shall state its reasons for that finding on the record.
One would think that 14 was the magic age but not necessarily so. There is case law that has allowed children 10 and 13, with maturity, to have their wishes given weight. On the other hand there is case law that did not allow a 14 year old consideration because he lacked the necessary maturity.
So the answer to the question, “When Can a Child Voice Their Preference in Custody Disputes?" is it depends.