woocommerce payment methods

拜拜、爱过 提交于 2019-12-25 16:52:57

问题


I want to edit woocommerce payment according to chosen shipping method. I tried it like this, but it doesn't work.

add_filter('woocommerce_available_payment_gateways','wpml_filter_gateways',1);

function wpml_filter_gateways( $gateways ) {
if( isset( $available_methods['flat_rate:dobirka'] )){
 unset($gateways['paypal']);
 }
    return $gateways;
}

Any ideas?

Cheers.


回答1:


See link1, link2...

May be it will help you...

function payment_gateway_disable_country( $available_gateways )
{
    global $woocommerce;
    if( YOUR-CONDITION ){
        unset($available_methods['paypal']);
    }
    return $available_gateways;
}
add_filter( 'woocommerce_available_payment_gateways', 'payment_gateway_disable_country' );


来源:https://stackoverflow.com/questions/21832317/woocommerce-payment-methods

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!