我需要条件付款网关代码...
我的网站上有一个钱包系统,我想要有条件的付款网关进行验证和结帐...
如果账单金额为₹1000 /-,并且客户希望从钱包中支付部分金额,则剩余金额应通过在线系统支付,而不用货到付款... 我该如何解决...建议我输入新代码,因为我的代码无法正常工作
function woo_disable_cod($available_gateways)
{
//check whether the avaiable payment gateways have Cash on delivery and user is not logged in or he is a user with role customer
$current_user = wp_get_current_user();
if (isset($available_gateways['cod']) && ((current_user_can('customer') && $current_user->user_firstname == 'Peter') || !is_user_logged_in())) {
//remove the paypal payment gateway from the available gateways.
unset($available_gateways['paypal']);
}
return $available_gateways;
}