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;...

December 4, 2020 WPSlash

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' );
    } 

}

Commission-free ordering

Run restaurant orders on your own WordPress site

FoodMaster adds delivery, pickup, dine-in, POS, and kitchen tools — with zero per-order fees.

Get FoodMaster

Leave a Comment

Your email address will not be published. Required fields are marked *

×

🔥 ONE DAY ONLY OFFER 🔥

Upgrade FoodMaster Today

Normally your license is limited to 1 Website.

Today only, get a LIFETIME Unlimited Websites License for just:
$499

✔ Unlimited Client Websites
✔ Unlimited Personal Projects
✔ Future Updates Included
✔ Save Hundreds on Additional Licenses

Offer Ends In: