Prior to the 1900s, U.S. Presidential candidates were either nominated by Members of Congress or chosen by party bosses at national conventions.
According to Wikipedia:
“In 1910, Oregon became the first state to establish a presidential preference primary in which the delegates to the National Convention were required to support the winner of the primary at the convention. By 1912, twelve states either selected delegates in primaries, used a preferential primary, or both.”
By 1920, twenty states held presidential primaries, but some -- such as Iowa, Vermont and Montana -- repealed their primary laws, having found that “most of their citizens did not bother to vote in presidential primaries.”