5

I am facing issue related payment method show for the specific country using Magento 2.2.6. Below are the steps followed by me

  1. Set "Payment from Applicable Countries" to Specific Countries and a select couple of countries.

  2. On Frontend - open checkout and select any allowed country and click NEXT. It will show desired payment methods in the next step.

  3. Go back to Step #1 and select any other country which doesn't allow Check and Money Order and click NEXT.

  4. It will still show Check and Money Order though it is set to NO for the selected country.

This issue is also available on git hub community but I didn't find any solution. https://github.com/magento/magento2/issues/10234

Please help me to solve this default Magento 2 issue.

4
  • I think the issue will be resolved if you update to the latest Magento version Mar 7, 2019 at 5:48
  • this issue is coming in Magento 2.3 also
    – Aish
    Mar 7, 2019 at 5:50
  • any update on this issue. I didn't find any solution for this.
    – Aish
    Mar 27, 2019 at 5:35
  • Have you found any solution for this?
    – Meera
    Jul 29, 2020 at 8:33

1 Answer 1

1

Not sure if this has been fixed or not or in what terms it can be reproduced but I found it and had some problems with it in version 2.3.5. I tracked the code down to this file:

vendor/magento/module-payment/Model/Checks/CanUseForCountry/CountryProvider.php

For whatever reason it seems that (on a multi store at least) the billing address country always gets to be NULL and goes back to the default country set in configurations. I don't exactly know why it gets null on billing address country but I wrote a workaround to always get the shipping address country (that seems to always be the right one).

I made a plugin with an after for the method getCountry() and replaced this:

    $address = $quote->getBillingAddress() ? : $quote->getShippingAddress();

with this:

    $address = $quote->getShippingAddress();

Now I don't have any problems. I really don't know where this bug comes from and why that billing country is always NULL but at least now it works as intended. Hope it helps.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.