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

Restaurants Tutorials

The Cheapest Food Delivery App for Restaurants Isn’t an App at All — It’s WooFood

When restaurant owners start looking for the cheapest food delivery app, they quickly discover a frustrating truth: most “cheap” delivery platforms aren’t cheap at all. They either take commissions, charge high monthly fees, lock you into their payment processors, or limit how much control you have over your own customer base. But what if the […]
December 1, 2025
Restaurants WooFood

Why “Free” GloriaFood Might Not Be The Best Long-Term Bet For Your Restaurant

When you’re building an online ordering system for your restaurant, it’s tempting to go for a “free” solution. That’s exactly what GloriaFood offers: a ready-to-go, easy-to-install WordPress plugin for online ordering, delivery, and reservations with no setup fees or commissions But “free” doesn’t always mean “best,” especially when you’re serious about owning your brand, your […]
December 1, 2025
Tutorials WooCommerce

How to Choose the Best Food Ordering System for Your Restaurant (And Why WooFood is the Ultimate Solution)

If you’re running a restaurant, café, or fast-food business in today’s digital age, offering online food ordering is no longer optional — it’s essential. Customers expect the convenience of browsing your menu, customizing their orders, and checking out seamlessly from their phone or computer. But with so many plugins and systems available, how do you choose the right […]
April 21, 2025