Last active
June 7, 2017 17:43
-
-
Save acanza/1fb4802bcc97282e0328a61073e60844 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 X€ | |
add_filter( 'woocommerce_available_payment_gateways', 'disable_cod_gateway_by_cart_total_amount', 1 ); | |
function disable_cod_gateway_by_cart_total_amount( $gateways ){ | |
$total_amount = 100; // Indica aquí el coste del carrito a partir del cual se deshabilita el pago contra-reembolso | |
if( ( WC()->cart->total > $total_amount ) && ( 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