WPSlash

Disable Cash On Delivery for Delivery Orders on WooFood

Friday December 4, 2020

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

}

Leave a Comment

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

Related Articles

WooFood

How to Disable Coupons for Delivery Orders in WooCommerce

If you’re running a WooCommerce-powered restaurant or food delivery service, you might want to restrict certain coupon codes for delivery orders while keeping them valid for pickup orders. This ensures better control over discounts, prevents misuse, and improves your store’s pricing strategy. Why Restrict Coupons for Delivery Orders? Offering coupons is a great way to attract customers, but in food […]
June 20, 2023
WooFood

How to Automatically Re-Enable Disabled Products in WooFood Once a Day

If you’re running a WooCommerce-powered restaurant ordering system using WooFood, you might have products that automatically get disabled due to stock limits or availability settings. To ensure a smooth customer experience, you can automate the re-enabling process using a scheduled WordPress cron job. This method allows you to reset all product availability once a day, ensuring your menu stays active without manual intervention. Why […]
March 8, 2023
WooFood

How to Add Live Product Search to WooFood in WooCommerce

Enhancing the user experience of your WooCommerce-powered restaurant ordering system is crucial, and adding a live product search feature can significantly improve navigation. This feature allows customers to quickly find food items in your WooFood-powered menu without manually browsing through categories. In this article, we’ll show you how to integrate a live product search above the accordion menu in WooFood using a simple jQuery script and PHP snippet. […]
December 29, 2022