mollie / magento2

Mollie Payments for Magento 2
https://www.mollie.com
Other
102 stars 53 forks source link

Location of the payment method changes based on the Country setting #307

Closed gerben86 closed 4 years ago

gerben86 commented 4 years ago

Describe the bug I enabled all payment methods for all available countries. I decided to change it, so that BanContact is only visible for Belgium-customers.

I'd expect that the BanContact-payment method would stay at the same position in the list, so the "sorteervolgorde" would be honoured.

Used versions

To Reproduce Steps to reproduce the behavior:

  1. Make the payment method BanContact only available in Belgium: image
  2. Go the the checkout and check the position of the BanContact payment method.

Expected behavior BanContact should stay at the same position as before (2nd place): image

Actual behavior BanContact stood at the end of the list: image

Frank-Magmodules commented 4 years ago

Hello @gerben86,

Thank you for opening this issue. This happens due to the way Magento renders the payment methods. The code responsible for this is found here: https://github.com/magento/magento2/blob/2.4-develop/app/code/Magento/Checkout/view/frontend/web/js/view/payment/list.js#L132-L159

This only happens when you go through the checkout this way:

The second time Magento will render only the payment methods that are not rendered before and hereby adding them to the list with existing payment methods. If you fill in the correct country right away then the list with payment methods will get rendered the way as expected.

gerben86 commented 4 years ago

@Frank-Magmodules ,

You're right, this is indeed the behaviour. In the first attempt the BanContact-payment method is in the correct position.

Thanks! I'll close this bug.