Step 1
Take the current variant sequence for each product with its option values and available quantity, the merchant's stated ordering rule such as an ascending size ladder or saleable stock first, and the variant currently shown first because that position usually becomes the default selection.