In certain situations, you may encounter the need to sort payment methods that share the same name. This scenario typically arises when utilizing Shopify Payments, a payment gateway that offers various methods such as Credit Card, Klarna, iDeal, and more. Despite their distinct functionalities, these methods appear with identical names in the logs, as illustrated in the following image.
To enable sorting of these payment methods, you will need to manually specify the name of the payment method, followed by the '#' symbol and the position at which it should appear.
For instance, if you wish to move at the first position the Shopify Payments method identified by the id gid://shopify/PaymentCustomizationPaymentMethod/5 to the top of the list, you would need to insert Shopify Payments#3. The number 3 is used because it is the third with the same name in the payment method list.