Forked from acanza/wc_disable_cod_gateway_by_cart_total_amount
Created
October 29, 2016 00:40
-
-
Save navalon/09f929be7aeb99c1a0861e5d5d9f1142 to your computer and use it in GitHub Desktop.
Deshabilita la opción de pago contra-reembolso cuando el pedido supera los 100€
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Deshabilita la opción de pago contra-reembolso cuando el pedido supera los 100€ | |
add_filter( 'woocommerce_available_payment_gateways', 'disable_cod_gateway_by_cart_total_amount', 1 ); | |
function disable_cod_gateway_by_cart_total_amount( $gateways ){ | |
if( ( WC()->cart->total > 100 ) && ( array_key_exists( 'cod', $gateways ) ) ) { | |
unset( $gateways[ 'cod' ] ); | |
} | |
return $gateways; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment