问题
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