Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save navalon/09f929be7aeb99c1a0861e5d5d9f1142 to your computer and use it in GitHub Desktop.
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€
// 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