2014-06-16 6 views

답변

0
//Hide payment gateways based on shipping method 
function payment_gateway_disable($available_gateways) { 
    global $woocommerce; 
    $chosen_methods = WC()->session->get('chosen_shipping_methods'); 
    $chosen_shipping = $chosen_methods[0]; 

    if($chosen_shipping == 'table_rate') { 
     unset($available_gateways['paytrail']); 
    } 

    return $available_gateways; 
} 
add_filter('woocommerce_available_payment_gateways', 'payment_gateway_disable');