Disable Cash On Delivery for Delivery Orders on WooFood

Here is a small code snippet you can add on your site to disable COD for Delivery Orders . You can still able to use COD on Pickup Orders.

Just copy and paste the following snippet to your functions.php inside your child theme

function wpslash_payment_gateway_disable_for_delivery( $available_gateways ) {
global $woocommerce;
    unset(  $available_gateways['cod'] );

return $available_gateways;
}




add_action("woofood_checkout_triggers", "wpslash_disable_payment_methods_by_order_type", 10, 2);
function wpslash_disable_payment_methods_by_order_type($data, $order_type)
{



     if ( $order_type == 'delivery' ) {

      add_filter( 'woocommerce_available_payment_gateways', 'wpslash_payment_gateway_disable_for_delivery' );
    } 

}