Hi guys, I’m trying to learn how i can use functions for building payment customization, for example i took this and build successfully https://shopify.dev/docs/apps/checkout/payments/getting-started where in this example is hiding the COD (cash on delivery) when the total amount is over 100, all good until here.
But i want to reorder for example COD to be first and then Gateway Payment with card to be the last one, how i can do that? I look into this: https://shopify.dev/docs/api/functions/reference/payment-customization where they mention about:
sort | Sorts the payment options based on some criteria, typically to place one payment option at the top or bottom of a list | MoveOperation | Instead of sorting, you can move individual payment methods. |
---|
But i don’t know exactly where I suppose to put this this sort, what I’ve tried is to put the sort at return here is my example:
return {
operations: [{
sort: {
index: -1,
paymentMethodId: hidePaymentMethod.id
},
hide: {
paymentMethodId: hidePaymentMethod.id
}
}]
};
This is at the end when the condition is true and is hiding the COD payment but i want to change that from hiding to reorder.
Thanks!