[英]BigCommerce: Limit Payment Options Based On Country
簡潔版本:
我只接受貝寶(Paypal)作為美國48歲以下以外的任何人的付款方式。
我看不到這不是bigcommerce在付款選項下已經安裝的功能,只是根據下拉菜單中的國家/地區選擇隱藏了這些付款網關。
不幸的是,我對bigcommerce的了解還不夠,但是我設法在x-cart之類的其他購物車上對此進行了編碼,沒有太大問題。
目前,我們已禁止通過商家向美國境外的任何人付款,並在注冊您的付款帳戶時在我們的網站上放置了橫幅,但隨后人們會坐在那里嘗試輸入其CC信息12,000次,淹沒了我的郵箱帶有捕獲警報-_-
提前致謝
曲線奔跑的基石1.5主題
一種可能的解決方案是使用JavaScript讀取運輸或開票國家/地區,然后顯示相關的付款方式。
這是一個概念性示例,假設您知道如何選擇特定元素(使用瀏覽器的開發人員工具為目標元素確定適當的選擇器)。
/**
* 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.