WordPress filter hook

woocommerce_admin_order_item_count

Fired by 3 WordPress plugins, running on 10K+ sites between them.

How to use woocommerce_admin_order_item_count

It's a filter: your callback receives the value and 1 more argument, and must return the (changed) value. Add this to your theme's functions.php or a small custom plugin:

functions.php
add_filter( 'woocommerce_admin_order_item_count', function( $sprintf, $the_order ) {
	// Change $sprintf here.
	return $sprintf;
}, 10, 2 );

Argument names come from WCFM's source. Other plugins may pass different values: check the call in the plugin you're targeting below.

3 plugins that fire woocommerce_admin_order_item_count

Sorted by active installs. Each entry shows where the plugin calls the hook and what it passes.

  1. WCFM icon WCFM10,000+ installs apply_filters( 'woocommerce_admin_order_item_count', sprintf( _n( '%d item', '%d items', $total_qty, 'wc-frontend-manager' ), $total_qty ), $the_order ) controllers/customers/wcfm-controller-customers-details.php:184
  2. WC Restore the Purchased Items Column in Orders Page icon WC Restore the Purchased Items Column in Orders Page200+ installs apply_filters( 'woocommerce_admin_order_item_count', sprintf( _n( '%d item', '%d items', $the_order->get_item_count(), 'restore-purchased-items-column' ), (int) $the_order->get_item_count() ), $the_order ) restore-purchased-items-column.php:85
  3. Subscriptions & Recurring Payments for WooCommerce icon Subscriptions & Recurring Payments for WooCommerce10+ installs apply_filters( 'woocommerce_admin_order_item_count', sprintf( _n( '%d item', '%d items', $the_subscription->get_item_count(), 'subscriptions-recurring-payments-for-woocommerce' ), $the_subscription->get_item_count() ), $the_subscription ) inc/admin/class-awc-admin-post-types.php:552

Need a customisation built on this hook?

Tell us what you want to change and which plugin it's for. We'll write it, test it and send it back as a small plugin.