While affix ordering often reflects general syntactic or semantic principles, it can also be arbitrary or variable. This article develops a theory of morpheme ordering based on local morphotactic restrictions encoded as weighted bigram constraints. I examine the formal properties of morphotactic systems, including arbitrariness, nontransitivity, context-sensitivity, analogy, and variation. Several variable systems are surveyed before turning to a detailed corpus study of a variable affix in Tagalog. Bigram morphotactics is shown to cover Tagalog and the typology, while other formalisms, such as alignment, precedence, and position classes, undergenerate. Moreover, learning simulations reveal that affix ordering under bigram morphotactics is subject to analogical pressures, providing a learning-theoretic motivation for the specific patterns of variation observed in Tagalog. I raise a different set of objections to rule-based approaches invoking affix movement. Finally, I demonstrate that bigram morphotactics is restrictive, being unable to generate unattested scenarios such as nonlocal contingency in ordering.