How to Hide Hidden Products From the WooCommerce Cart, Orders and Emails

How to Hide Hidden Products From the WooCommerce Cart, Orders and Emails
On this page
  1. Why This Extra Step Is Needed
  2. Step 1: Hide From the Cart and Checkout Item List
  3. Step 2: Hide From Order Item Lists and Emails
  4. Troubleshooting
  5. Frequently Asked Questions
  6. Conclusion

You can hide hidden products from the WooCommerce cart, orders and emails by filtering out any line item whose product’s catalog visibility is set to “hidden,” since setting a product to hidden only removes it from the shop and category pages by default — it can still appear anywhere it was added programmatically, like a gift or bundled item.

Why This Extra Step Is Needed

  • WooCommerce’s “hidden” catalog visibility only controls shop/category listing, not cart or order display
  • Programmatically added products (gifts, samples, bundled items) can surface unexpectedly in emails or the cart
  • Keeps promotional or internal-only products fully invisible to customers, everywhere

Step 1: Hide From the Cart and Checkout Item List

PHP
/** Remove hidden-visibility products from the visible cart item list */
add_filter( 'woocommerce_cart_item_visible', 'exclude_hidden_products_from_cart_display', 10, 2 );

function exclude_hidden_products_from_cart_display( $is_visible, $cart_item ) {
    $product = $cart_item['data'];

    if ( $product && 'hidden' === $product->get_catalog_visibility() ) {
        return false;
    }

    return $is_visible;
}

Step 2: Hide From Order Item Lists and Emails

PHP
/** Remove hidden-visibility products from order tables (thank-you page, emails, account) */
add_filter( 'woocommerce_order_item_visible', 'exclude_hidden_products_from_order_display', 10, 2 );

function exclude_hidden_products_from_order_display( $is_visible, $order_item ) {
    $product = $order_item->get_product();

    if ( $product && 'hidden' === $product->get_catalog_visibility() ) {
        return false;
    }

    return $is_visible;
}
Hide hidden products from the WooCommerce cart, orders and emails: the page before adding the code
Before
Hide hidden products from the WooCommerce cart, orders and emails: the page after adding the code
After

Troubleshooting

Product Still Shows in the Cart Totals

These filters hide the line item’s visual row, but the product’s price still factors into cart and order totals — this is intentional (a free gift priced at $0 won’t affect totals, but a hidden item with a real price still will).

Product Disappears from Admin Order View Too

These filters are scoped to customer-facing displays — the admin order edit screen uses different templates and typically still shows every line item, which is expected and useful for order management.

Want to Hide From Only One of These Areas

Apply only the relevant filter — use the cart filter alone if you only need it hidden from the cart/checkout, or the order filter alone for emails and account order history.

Frequently Asked Questions

Does making a product “hidden” alone stop it from appearing anywhere?

No — hidden catalog visibility only affects the shop and category archive listings. Anywhere the product is added directly to a cart or order, it can still display unless filtered separately.

Will this affect the order total shown to customers?

No — the total still reflects the hidden product’s price; only its visible line item row is suppressed.

Does this work for free gift products too?

Yes — this is commonly paired with an automatically-added free gift product so it stays completely invisible while still being technically present in the order.

Conclusion

Hiding hidden products from the WooCommerce cart, orders and emails requires two separate filters, since catalog visibility alone doesn’t cover cart or order display. Apply both together for full invisibility across the customer journey.

See also How to Exclude Hidden Products From the Mini-Cart Counter in WooCommerce. Then read How to Show SKU on the Cart, Checkout, and Order Emails.

Prefer no code? All-in-One Utilities Woo Add-on adds over 50 WooCommerce features, so you can switch them on without code.

Leave a Reply

Schedule a call