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!