WPSlash

How to Disable Coupons for Delivery Orders in WooCommerce

Tuesday June 20, 2023

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 delivery businesses, you may want to limit their usagefor:
✔ Preventing discounts on delivery orders where margins are lower
✔ Allowing coupon usage only for pickup orders
✔ Ensuring accurate pricing and preventing unintended losses

How to Disable Coupons for Delivery Orders in WooCommerce

To disable a WooCommerce coupon for delivery orders while keeping it valid for pickup, add the following code snippet to your child theme’s functions.php file:

add_filter( 'woocommerce_coupon_is_valid', 'wpslash_hook_disable_coupon_code_for_delivery', 10, 3 );
function wpslash_hook_disable_coupon_code_for_delivery( $is_valid, $coupon, $discount ){
    if (!is_admin())
    {

   
    $coupon_code_to_apply = "YOURCOUPONCODEHERE";
    if($coupon == $coupon_code_to_apply)
    {
      if(WC()->session)
      {
        if (WC()->session->get( 'woofood_order_type') == "delivery")
      {
        return false;
      }
      }
      
    }
  }
  
    return $is_valid;
}

Best Practices for Implementing This Code

✅ Replace "YOURCOUPONCODEHERE" with the actual coupon code you want to restrict.
✅ Test the code in a staging environment before deploying it live.
✅ Ensure that your WooCommerce setup and other plugins don’t conflict with this customization.

Need an Easier Way to Manage WooCommerce Restaurant Orders?

If you’re running a restaurant or food delivery service on WooCommerce, you need a seamless order management solution. Instead of manually restricting coupons and handling orders, you can use WooFood – WooCommerce Food Delivery Plugin.

With WooFood, you can:
✅ Accept pickup and delivery orders effortlessly
✅ Set up custom discounts and pricing rules based on order type
✅ Optimize the checkout experience for faster food ordering

👉 Check out WooFood to streamline your WooCommerce food delivery business today! 🚀

Leave a Comment

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

Related Articles

FoodMaster (formerly WooFood)

How to Set Up Time Slot-Based Ordering for Your WooCommerce Restaurant: Configurable Pickup and Delivery Time Slots, Slot Capacity Limits, and Preventing Order Overload During Peak Hours (Complete Guide)

Why Time Slot-Based Ordering Is Essential for Restaurant Websites Picture this: it’s Friday evening, and your online ordering system just accepted 47 orders in the span of 20 minutes. Your kitchen crew can realistically handle 15 orders per half hour. The result? Delivery times balloon from 30 minutes to over 90, customers start calling to […]
April 15, 2026
FoodMaster (formerly WooFood)

How to Set Up a Catering and Large Group Order System on Your WooCommerce Restaurant Website: Custom Menus, Minimum Order Requirements, Scheduled Delivery Windows, and Tiered Pricing for Events and Corporate Orders (Complete Guide)

Why Your Restaurant Needs a Dedicated Catering Order System Online Catering revenue in the United States reached an estimated $66.5 billion in 2023 according to the Catering Industry Association, and a significant portion of that spend is shifting online. Corporate clients, event planners, and families organizing celebrations increasingly expect to browse menus, customize orders, and […]
April 14, 2026
FoodMaster (formerly WooFood)

How to Set Up Scheduled Pre-Orders and Advance Meal Ordering for Your WooCommerce Restaurant: Let Customers Order Ahead for Pickup, Catering, and Special Events (Complete Guide)

Why Pre-Ordering Matters for Restaurants: The Business Case for Advance Meal Orders Picture this: it’s the Wednesday before Thanksgiving, and your kitchen is buried under a mountain of last-minute turkey dinner orders. Half your staff is scrambling to prep dishes they didn’t know about two hours ago, and three customers are calling to ask if […]
April 12, 2026