当结帐总额 == 400 但不起作用时,我尝试了下面的代码来隐藏/禁用 Woo commerce(WordPress)上的信用卡/借记卡和直接银行转帐付款方式。请任何想法如何实现这一目标?非常感谢你。
function payment_gateway_disable_total_amount( $available_gateways ) {
global $woocommerce;
if ( isset( $available_gateways['bacs'] ) && $woocommerce->cart->total == 400 ) {
unset( $available_gateways['bacs'] );
}
if ( isset( $available_gateways['youpay'] ) && $woocommerce->cart->total == 400 ) {
unset( $available_gateways['youpay'] );
}
return $available_gateways;
}
add_filter( 'woocommerce_available_payment_gateways', 'payment_gateway_disable_total_amount' );