📌  相关文章
📜  当 totla 为 0 时,woocommerce 删除付款方式 - PHP 代码示例

📅  最后修改于: 2022-03-11 14:54:04.875000             🧑  作者: Mango

代码示例1
function payment_gateway_disable_total_amount( $available_gateways ) {
global $woocommerce;
if ( isset( $available_gateways['paypal'] ) && $woocommerce->cart->total == 0 ) {
    unset(  $available_gateways['paypal'] );
}
    return $available_gateways;
}
add_filter( 'woocommerce_available_payment_gateways', 'payment_gateway_disable_total_amount' );