WordPress filter hook

woocommerce_cart_item_quantity

Defined by WooCommerce and fired by 53 plugins in total, running on 8.8M+ sites between them.

How to use woocommerce_cart_item_quantity

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

functions.php
add_filter( 'woocommerce_cart_item_quantity', function( $product_quantity, $cart_item_key, $cart_item ) {
	// Change $product_quantity here.
	return $product_quantity;
}, 10, 3 );

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

53 plugins that fire woocommerce_cart_item_quantity

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

  1. WooCommerce icon WooCommerce7+ million installs apply_filters( 'woocommerce_cart_item_quantity', $product_quantity, $cart_item_key, $cart_item ) templates/cart/cart.php:180
  2. Essential Addons for Elementor icon Essential Addons for Elementor1+ million installs apply_filters( 'woocommerce_cart_item_quantity', $product_quantity, $cart_item_key, $cart_item ) includes/Template/Woocommerce/Cart/Woo_Cart_Helper.php:196
  3. Royal Addons for Elementor icon Royal Addons for Elementor600,000+ installs apply_filters( 'woocommerce_cart_item_quantity', $product_quantity, $cart_item_key, $cart_item ) includes/woocommerce/templates/cart/cart.php:122
  4. ShopEngine icon ShopEngine90,000+ installs apply_filters( 'woocommerce_cart_item_quantity', $product_quantity, $cart_item_key, $cart_item ) widgets/cart-table/screens/cart.php:198
  5. Sliding Cart for WooCommerce by FunnelKit icon Sliding Cart for WooCommerce by FunnelKit30,000+ installs apply_filters( 'woocommerce_cart_item_quantity', $product_quantity_input, $cart_item_key, $cart_item ) includes/front.php:445
  6. WPC Fly Cart for WooCommerce icon WPC Fly Cart for WooCommerce10,000+ installs apply_filters( 'woocommerce_cart_item_quantity', $cart_item_quantity, $cart_item_key, $cart_item ) wpc-fly-cart.php:532
  7. ShopBuilder icon ShopBuilder10,000+ installs apply_filters( 'woocommerce_cart_item_quantity', $product_quantity, $cart_item_key, $cart_item, $table ) templates/elementor/cart/cart-table.php:154
  8. CoDesigner icon CoDesigner4,000+ installs apply_filters( 'woocommerce_cart_item_quantity', $product_quantity, $cart_item_key, $cart_item ) widgets/cart-items/cart-items.php:2048
  9. Ultimate Store Kit icon Ultimate Store Kit3,000+ installs apply_filters( 'woocommerce_cart_item_quantity', $product_quantity, $item, $values ) modules/page-cart/widgets/page-cart.php:1705
  10. ShopEngine Gutenberg WooCommerce Builder Blocks Addon icon ShopEngine Gutenberg WooCommerce Builder Blocks Addon3,000+ installs apply_filters( 'woocommerce_cart_item_quantity', $product_quantity, $cart_item_key, $cart_item ) blocks/cart-table/cart.php:132
  11. StoreGrowth icon StoreGrowth2,000+ installs apply_filters( 'woocommerce_cart_item_quantity', $product_quantity, $cart_item_key, $cart_item ) modules/fly-cart/templates/cart-contents.php:104
  12. WP Hotel Booking WooCommerce icon WP Hotel Booking WooCommerce1,000+ installs apply_filters( 'woocommerce_cart_item_quantity', $product_quantity, $cart_item_key, $cart_item ) templates/woocommerce/cart/cart.php:194
  13. Mini Ajax Cart for WooCommerce icon Mini Ajax Cart for WooCommerce800+ installs apply_filters( 'woocommerce_cart_item_quantity', $majc_product_quantity, $majc_item_key, $majc_item_val ) classes/frontend-class.php:162
  14. Instantio icon Instantio700+ installs apply_filters( 'woocommerce_cart_item_quantity', $instantio_product_quantity, $instantio_cart_item_key, $instantio_cart_item ) includes/templates/cart-modern.php:186
  15. WC Booster icon WC Booster700+ installs apply_filters( 'woocommerce_cart_item_quantity', $product_quantity, $cart_item_key, $cart_item ) woocommerce/cart/cart.php:89
  16. MarketKing icon MarketKing700+ installs apply_filters( 'woocommerce_cart_item_quantity', $product_quantity, $cart_item_key, $cart_item ) public/templates/cart.php:194
  17. ShopPress icon ShopPress600+ installs apply_filters( 'woocommerce_cart_item_quantity', $product_quantity, $cart_item_key, $cart_item ) public/templates/cart/cart-table.php:136
  18. Save and Share Cart for WooCommerce icon Save and Share Cart for WooCommerce500+ installs apply_filters( 'woocommerce_cart_item_quantity', $product_quantity, $cart_item_key, $cart_item ) templates/single-saved-cart.php:95
  19. PDF Invoice for WooCommerce + Drag and Drop Template Builder icon PDF Invoice for WooCommerce + Drag and Drop Template Builder500+ installs apply_filters( 'woocommerce_cart_item_quantity', $product_quantity, $cart_item_key, $cart_item ) woocommerce/templates/carts/cart-product.php:68
  20. StoreBuild icon StoreBuild400+ installs apply_filters( 'woocommerce_cart_item_quantity', $storebuild_product_quantity, $storebuild_cart_item_key, $storebuild_cart_item ) public/woocommerce/cart/cart.php:119
  21. Noah Shop Builder for WooCommerce icon Noah Shop Builder for WooCommerce400+ installs apply_filters( 'woocommerce_cart_item_quantity', $quantity, $cart_item_key, $cart_item ) includes/Blocks/CartTable.php:220
  22. CRT Addons Builder and Widgets for Elementor icon CRT Addons Builder and Widgets for Elementor300+ installs apply_filters( 'woocommerce_cart_item_quantity', $product_quantity, $cart_item_key, $cart_item ) includes/customizer/addons/templates/cart/cart.php:122
  23. Food Online for WooCommerce icon Food Online for WooCommerce300+ installs apply_filters( 'woocommerce_cart_item_quantity', $product_quantity, $cart_item_key, $cart_item ) templates/cart/mini-cart-incre.php:78
  24. Free Product Sample for WooCommerce icon Free Product Sample for WooCommerce200+ installs apply_filters( 'woocommerce_cart_item_quantity', $product_quantity, $cart_item_key, $cart_item ) public/partials/woocommerce/cart/cart.php:125
  25. KiriminAja Official icon KiriminAja Official200+ installs apply_filters( 'woocommerce_cart_item_quantity', $kiriof_product_quantity, $cart_item_key, $cart_item ) templates/woocommerce/cart/cart.php:151
  26. Shopready icon Shopready100+ installs apply_filters( 'woocommerce_cart_item_quantity', $product_quantity, $cart_item_key, $cart_item ) src/extension/templates/presets/cart/cart.php:158
  27. Modal COD Form for woocommerce icon Modal COD Form for woocommerce100+ installs apply_filters( 'woocommerce_cart_item_quantity', $modalcodf_cart_item['quantity'], $modalcodf_cart_item, $modalcodf_cart_item_key ) templates/table-content.php:14
  28. ShopMaker icon ShopMaker90+ installs apply_filters( 'woocommerce_cart_item_quantity', $product_quantity, $cart_item_key, $cart_item ) templates/widgets/sm-parts/cart-table.php:123
  29. AMP WooCommerce icon AMP WooCommerce90+ installs apply_filters( 'woocommerce_cart_item_quantity', $product_quantity, $cart_item_key, $cart_item ) templates/cart/cart.php:115
  30. Gift Vouchers for WooCommerce icon Gift Vouchers for WooCommerce80+ installs apply_filters( 'woocommerce_cart_item_quantity', $product_quantity, $cart_item_key, $cart_item ) templates/cart/cart.php:133
  31. WebSync Checkout for Elementor icon WebSync Checkout for Elementor50+ installs apply_filters( 'woocommerce_cart_item_quantity', $product_quantity, $cart_item_key, $cart_item ) templates/cart/custom-cart.php:108
  32. Awesome Checkout Templates icon Awesome Checkout Templates40+ installs apply_filters( 'woocommerce_cart_item_quantity', $product_quantity, $cart_item_key, $cart_item ) public/front-checkout.php:659
  33. One Page Checkout for WooCommerce icon One Page Checkout for WooCommerce30+ installs apply_filters( 'woocommerce_cart_item_quantity', $product_quantity, $cart_item_key, $cart_item ) public/templates/cart/cart.php:107
  34. Restaurant Menu / bulk order plugin for WooCommerce icon Restaurant Menu / bulk order plugin for WooCommerce20+ installs apply_filters( 'woocommerce_cart_item_quantity', $product_quantity, $cart_item_key, $cart_item ) front/view/woocommerce/cart/cart-empty.php:130
  35. Elite Elementor Addons and Widgets icon Elite Elementor Addons and Widgets20+ installs apply_filters( 'woocommerce_cart_item_quantity', $product_quantity, $cart_item_key, $cart_item ) includes/woocommerce/templates/cart/cart.php:122
  36. Max Elements for Elementor icon Max Elements for Elementor10+ installs apply_filters( 'woocommerce_cart_item_quantity', $product_quantity, $cart_item_key, $cart_item ) elementor/helpers/woo_cart.php:190
  37. SBS icon SBS10+ installs apply_filters( 'woocommerce_cart_item_quantity', $product_quantity, $cart_item_key ) templates/cart/cart.php:95
  38. Express Shop for WooCommerce Product Table icon Express Shop for WooCommerce Product Table10+ installs apply_filters( 'woocommerce_cart_item_quantity', $product_quantity, $cart_item_key, $cart_item ) inc/cart/cart.php:113
  39. Categorized Cart Page For Woocommerce icon Categorized Cart Page For Woocommerce10+ installs apply_filters( 'woocommerce_cart_item_quantity', $product_quantity, $cart_item_key, $cart_item ) templates/cart.php:133
  40. Manual Orders for Woocommerce icon Manual Orders for Woocommerce10+ installs apply_filters( 'woocommerce_cart_item_quantity', $product_quantity, $cart_item_key, $cart_item ) templates/checkout/cart.php:110
  41. Cart Products for WordPress icon Cart Products for WordPress10+ installs apply_filters( 'woocommerce_cart_item_quantity', $product_quantity, $cart_item_key, $cart_item ) templates/products-list.php:79
  42. Alter Inventory icon Alter Inventory10+ installs apply_filters( 'woocommerce_cart_item_quantity', $product_quantity, $cart_item_key, $cart_item ) admin/partials/woocommerce-alter-inventory-custom-cart.php:89
  43. Formdev icon Formdev10+ installs apply_filters( 'woocommerce_cart_item_quantity', $product_quantity, $cart_item_key, $cart_item ) templates/cart.php:244
  44. Ajax mini cart for Woocommerce icon Ajax mini cart for WoocommerceFewer than 10 installs apply_filters( 'woocommerce_cart_item_quantity', $product_quantity, $cart_item_key, $cart_item ) src/zt-front-end.php:98
  45. Cresta Checkout for WooCommerce icon Cresta Checkout for WooCommerceFewer than 10 installs apply_filters( 'woocommerce_cart_item_quantity', $quantity, $key, $cart_item ) inc/blocks/blocks-cart.php:139
  46. StoreBooster icon StoreBoosterFewer than 10 installs apply_filters( 'woocommerce_cart_item_quantity', $ttsb_product_quantity, $ttsb_cart_item_key, $ttsb_cart_item ) templates/cart/cart-contents.php:95
  47. PaymentIQ Checkout icon PaymentIQ CheckoutFewer than 10 installs apply_filters( 'woocommerce_cart_item_quantity', $product_quantity, $cart_item_key, $cart_item ) templates/paymentiq-cart-page.php:121
  48. Portus Cart Page icon Portus Cart PageFewer than 10 installs apply_filters( 'woocommerce_cart_item_quantity', $portus_quantity, $portus_key, $portus_item ) templates/cart.php:50
  49. YayCheckout icon YayCheckoutFewer than 10 installs apply_filters( 'woocommerce_cart_item_quantity', self::stepper_html( $product, $cart_item, $cart_item_key ), $cart_item_key, $cart_item ) includes/Renderer/CheckoutFragments.php:1084
  50. Arshida Toolkit for WooCommerce icon Arshida Toolkit for WooCommerceFewer than 10 installs apply_filters( 'woocommerce_cart_item_quantity', $product_quantity_input, $cart_item_key, $cart_item ) src/WC/Cart/Helper.php:128
  51. Aiolos Checkout for WooCommerce icon Aiolos Checkout for WooCommerceFewer than 10 installs apply_filters( 'woocommerce_cart_item_quantity', $default, $key, $item ) src/Cart/CartItem.php:338
  52. Bazario icon BazarioFewer than 10 installs apply_filters( 'woocommerce_cart_item_quantity', $product_quantity, $cart_item_key, $cart_item ) elements/widgets/cart-products/cart.php:126
  53. Samply icon SamplyFewer than 10 installs apply_filters( 'woocommerce_cart_item_quantity', $product_quantity, $cart_item_key, $cart_item ) includes/Frontend/views/woocommerce/cart/cart.php:125

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.