简体   繁体   English

BigCommerce:基于国家/地区的限额付款方式

[英]BigCommerce: Limit Payment Options Based On Country

Short Version: 简洁版本:
I want to only accept Paypal as the form of payment for anyone outside of the lower 48 in the US. 我只接受贝宝(Paypal)作为美国48岁以下以外的任何人的付款方式。

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. 我看不到这不是bigcommerce在付款选项下已经安装的功能,只是根据下拉菜单中的国家/地区选择隐藏了这些付款网关。

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? 不幸的是,我对bigcommerce的了解还不够,但是我设法在x-cart之类的其他购物车上对此进行了编码,没有太大问题。

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 -_- 目前,我们已禁止通过商家向美国境外的任何人付款,并在注册您的付款帐户时在我们的网站上放置了横幅,但随后人们会坐在那里尝试输入其CC信息12,000次,淹没了我的邮箱带有捕获警报-_-
Thanks in advance 提前致谢

Currnetly running Cornerstone 1.5 Theme 曲线奔跑的基石1.5主题

One possible solution could be to use JavaScript to read either the shipping or billing country and then display the relevant payment methods. 一种可能的解决方案是使用JavaScript读取运输或开票国家/地区,然后显示相关的付款方式。

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;
  }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM