WPSlash

How to Conditionally Exclude Orders from Automatic Printing in WooCommerce

Tuesday April 6, 2021

For restaurants and food delivery businesses using WooFood’s Automatic Order Printing Software, there may be situations where you don’t want certain orders to be printed automatically. For example, gift card purchases, digital products, or specific menu items may not require a printed order ticket.

With a simple WooCommerce filter, you can dynamically exclude orders from being processed by the automatic printing software based on specific conditions.


Why Exclude Certain Orders from Automatic Printing?

✔ Prevents unnecessary order printing – Avoids wasting paper on digital or non-food items.
✔ Customizes order processing – Exclude gift cards, promotional items, or specific menu categories.
✔ Enhances workflow efficiency – Ensures only relevant food orders are sent to the kitchen.
✔ Works seamlessly with WooFood – Fully compatible with the WooFood order management system.


How to Exclude Specific Orders from WooFood’s Automatic Printing System

To prevent specific WooCommerce orders from being printed automatically, add the following PHP snippet to your theme’s functions.php file:

add_filter("woofood_rest_include_order_in_software", "wpslash_exclude_order_from_software", 10, 2);
function wpslash_exclude_order_from_software($bool, $order_data)
{
	global $woocommerce;
	foreach ( $order_data["line_items"] as $line_item ) {
   $product_id = intval($line_item['product_id']);
 	$product = wc_get_product($product_id);
		
		if ($product->is_type('gift-card')) {
        	return false;


    }
}
	return $bool;
}

How This Code Works

✅ The woofood_rest_include_order_in_software filter controls whether an order is included in the WooFood automatic printing system.
✅ The function checks all products in an order to see if any are classified as “Gift Cards”.
✅ If a gift card product type is detected, the order is excluded from printing.
✅ Otherwise, the order is processed as usual and sent to the kitchen printer.


Best Practices for Implementing Conditional Order Exclusions

🔹 Customize the product type – Modify the filter to exclude other categories, like merchandise or digital downloads.
🔹 Expand conditions – Add logic to exclude orders based on shipping method, payment type, or specific user roles.
🔹 Test before deployment – Ensure the function works correctly by placing test orders.


Upgrade Your WooCommerce Food Ordering System with WooFood

Managing restaurant and food delivery orders efficiently is essential for seamless operations. Instead of manually sorting which orders should be printed, you can automate the process with WooFood’s advanced order management features.

Why Choose WooFood?

✅ Fully customizable order processing – Control which orders are printed automatically.
✅ Perfect for food businesses – Supports delivery, pickup, and in-house dining orders.
✅ Compatible with WooCommerce – Easily integrates into your existing WordPress website.
✅ Automatic order printing – Send relevant orders directly to the kitchen without delays.

🚀 Optimize Your WooCommerce Restaurant Ordering System Today!

👉 Check out WooFood – The Ultimate WooCommerce Food Delivery Plugin and streamline your restaurant’s order processing!

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
Tutorials

How to Set Up Stripe, PayPal, and Square Payment Gateways for Your WooCommerce Restaurant Ordering System: Step-by-Step Configuration, Transaction Fees Comparison, and Optimizing Checkout for Faster Food Orders (Complete Guide)

Why Payment Gateway Choice Matters for Restaurant Websites A customer is hungry, they’ve spent three minutes building the perfect pad thai order with extra peanuts and a side of spring rolls, and they hit “Checkout.” If the next screen loads slowly, asks them to create an account, or doesn’t support their preferred payment method, that […]
April 14, 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