0

Short Version:
I want to only accept Paypal as the form of payment for anyone outside of the lower 48 in the US.

I don't see how this isn't a feature already installed in bigcommerce under payment options and simply hiding those payment gateways based on the selection from the dropdown country menu.

Unfortunately I don't know bigcommerce well enough but I've managed to code this in on other carts like x-cart without much issue.. Has anyone experienced this or have a fix for me?

Currently we have disabled payments via our merchant to anyone outside of the US and placed a banner on our site when signing up for your account for payment, but then people will sit there and try to enter their CC information 12 thousand times flooding my mail box with capture alerts -_-
Thanks in advance

Currnetly running Cornerstone 1.5 Theme

1 Answers1

0

One possible solution could be to use JavaScript to read either the shipping or billing country and then display the relevant payment methods.

Here's a conceptual example assuming you know how to select the specific elements (use your browser's developer tools to determine the proper selectors for your target elements)..

/**
 * This example binds a change event to the shipping country input dropdown, 
 * so whenever a country is selected or changed, this code will show the relevant
 * payment methods. 
 * NOTE: The change method here might not work if the payment methods section
 * is inaccessible at the time of country selection, at which point you should
 * modify the code to read the country at the time of DOM load for the payment methods.
 */

//** Whenever the shipping country is selected or changed **//
$("#shipping_country_dropdown").change(function() {
  // Hide/Clear all visible payment options:
  $(".payment_methods :input").each(function() {
    $(this).hide();
  });
  togglePaymentMethodsByCountry($(this).find('option:selected').text());
});

/**
 * Displays specific payment methods depending on the customer's selected billing or shipping country. 
 * You set the list of countries and their allowed payment methods here. 
 * @param country String - The customer selected country. 
 * @return Void
 */
function togglePaymentMethodsByCountry(country) {
  //** Define your country/payment options here, countries in caps **//
  switch(country.toUpperCase()) {
    case "UNITED STATES OF AMERICA":
      $('#payment_method_1').show();
      $('#payment_method_2').show();
      $('#payment_method_3').show();
      break;
    case "CANADA":
      $('#payment_method_1').show();
      $('#payment_method_2').show();
      break;
    default:
      // For all other countries not listed above:
      $('#payment_method_3').show();
      break;
  }
}
sudo soul
  • 1,504
  • 13
  • 20