Variant Position Mapping Issues in Shopify: REST API vs. GraphQL API

Using the REST API, we successfully mapped and updated the variant positions on Shopify. However, when attempting the same process with the GraphQL API, we encountered the following error:

"Variant position must be between 1 and the number of variants on the product."

This issue causes the variant order to change unpredictably each time the product is updated through the flow. To prevent the sizes from scrambling, we need to correctly map the variant positions when using the GraphQL API.

Have you attempted using the position field in the mapping to set them to the same order you would like when they go through the flow? Under each variant in the mapping you can add a field called position and set it to a number that as that error says, but be between 1 and the number of variants.

If you don't have this position value set then it orders the variants on the store in whatever order they appear in your mapping.