WordPress filter hook

woocommerce_cart_needs_shipping

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

“Hooks”

How to use woocommerce_cart_needs_shipping

It's a filter: your callback receives the value, 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_needs_shipping', function( $needs_shipping ) {
	// Change $needs_shipping here.
	return $needs_shipping;
}, 10, 1 );

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

40 plugins that fire woocommerce_cart_needs_shipping

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_needs_shipping', $needs_shipping ) includes/class-wc-cart.php:1869
  2. Booster for WooCommerce icon Booster for WooCommerce30,000+ installs apply_filters( 'woocommerce_cart_needs_shipping', $needs_shipping ) includes/class-wcj-payment-gateways-by-shipping.php:98
  3. Custom Payment Gateways for WooCommerce icon Custom Payment Gateways for WooCommerce8,000+ installs apply_filters( 'woocommerce_cart_needs_shipping', $needs_shipping ) includes/class-wc-gateway-alg-custom-template.php:227
  4. Cash On Pickup for WooCommerce icon Cash On Pickup for WooCommerce7,000+ installs apply_filters( 'woocommerce_cart_needs_shipping', $needs_shipping ) classes/class.wc-cop.php:475
  5. GoDaddy Payments for WooCommerce icon GoDaddy Payments for WooCommerce3,000+ installs apply_filters( 'woocommerce_cart_needs_shipping', true ) src/Gateways/PayInPersonGateway.php:609
  6. Invoice Payment Gateway for WooCommerce icon Invoice Payment Gateway for WooCommerce2,000+ installs apply_filters( 'woocommerce_cart_needs_shipping', $needs_shipping ) includes/class-wc-invoice-gateway.php:256
  7. Pay in Store WooCommerce Payment Gateway icon Pay in Store WooCommerce Payment Gateway2,000+ installs apply_filters( 'woocommerce_cart_needs_shipping', $needs_shipping ) classes/WC_Gateway_PayInStore.php:140
  8. Invoice Gateway for WooCommerce icon Invoice Gateway for WooCommerce2,000+ installs apply_filters( 'woocommerce_cart_needs_shipping', $needs_shipping ) Models/Gateways/IGFW_Invoice_Gateway.php:289
  9. BLAZING Email Transfer Payment Gateway icon BLAZING Email Transfer Payment Gateway2,000+ installs apply_filters( 'woocommerce_cart_needs_shipping', $needs_shipping ) class-betpg-email-transfer-gateway.php:234
  10. BjornTech Swish for WooCommerce icon BjornTech Swish for WooCommerce2,000+ installs apply_filters( 'woocommerce_cart_needs_shipping', $needs_shipping ) classes/woo-swish-payment-gateway.php:2978
  11. Novalnet Payment Gateway for WooCommerce icon Novalnet Payment Gateway for WooCommerce1,000+ installs apply_filters( 'woocommerce_cart_needs_shipping', $needs_shipping ) includes/class-wc-novalnet-validation.php:216
  12. CloudPayments Gateway for WooCommerce icon CloudPayments Gateway for WooCommerce500+ installs apply_filters( 'woocommerce_cart_needs_shipping', $needs_shipping ) inc/wc-cloud-payments-gateway.php:1081
  13. Payment Gateways by Shipping for WooCommerce icon Payment Gateways by Shipping for WooCommerce400+ installs apply_filters( 'woocommerce_cart_needs_shipping', $needs_shipping ) includes/class-alg-wc-pgbsm-core.php:165
  14. Payment gateway icon Payment gateway200+ installs apply_filters( 'woocommerce_cart_needs_shipping', $needs_shipping ) includes/class-wc-robokassa-method.php:2691
  15. B2B Invoice Payment Method for WooCommerce icon B2B Invoice Payment Method for WooCommerce100+ installs apply_filters( 'woocommerce_cart_needs_shipping', $needs_shipping ) Controller/Gateways/IPGW_Invoice_Gateway.php:294
  16. PayPal Checkout Payment for WooCommerce in Japan icon PayPal Checkout Payment for WooCommerce in Japan100+ installs apply_filters( 'woocommerce_cart_needs_shipping', $needs_shipping ) includes/class-wc-gateway-ppec-plugin.php:477
  17. WooPOS Gift Cards for WooCommerce icon WooPOS Gift Cards for WooCommerce80+ installs apply_filters( 'woocommerce_cart_needs_shipping', $needs_shipping ) includes/features/isc/isc-class.php:151
  18. Paiement par Carte DAHABIA et Carte CIB for WooCommerce icon Paiement par Carte DAHABIA et Carte CIB for WooCommerce70+ installs apply_filters( 'woocommerce_cart_needs_shipping', $needs_shipping ) includes/class-wc-satimipay-gateway.php:540
  19. Cash on Delivery of Russian Post or EMS For WooCommerce icon Cash on Delivery of Russian Post or EMS For WooCommerce70+ installs apply_filters( 'woocommerce_cart_needs_shipping', $needs_shipping ) cod-payment-gateway-russian-post.php:158
  20. CdekPay icon CdekPay60+ installs apply_filters( 'woocommerce_cart_needs_shipping', $needs_shipping ) includes/class-wc-cdekpay-gateway.php:393
  21. Credit Online Smart by BT Direct icon Credit Online Smart by BT Direct50+ installs apply_filters( 'woocommerce_cart_needs_shipping', $needs_shipping ) src/XFactor_Gateway_Krunity.php:887
  22. TipTopPay Gateway for WooCommerce icon TipTopPay Gateway for WooCommerce40+ installs apply_filters( 'woocommerce_cart_needs_shipping', $needs_shipping ) inc/wc-tiptoppay-gateway.php:891
  23. PAK Custom Payment Gateways for WooCommerce icon PAK Custom Payment Gateways for WooCommerce40+ installs apply_filters( 'woocommerce_cart_needs_shipping', $is_shipping_needed ) src/GatewayProcessor.php:279
  24. All BD Mobile Payments Gateway icon All BD Mobile Payments Gateway30+ installs apply_filters( 'woocommerce_cart_needs_shipping', $needs_shipping ) gateways/bKash.php:156
  25. Payment Gateway for Sparco on WooCommerce icon Payment Gateway for Sparco on WooCommerce20+ installs apply_filters( 'woocommerce_cart_needs_shipping', $needs_shipping ) includes/class-wc-sparco-payment-gateway.php:238
  26. Wallet & Store Credit for WooCommerce icon Wallet & Store Credit for WooCommerce20+ installs apply_filters( 'woocommerce_cart_needs_shipping', $needs_shipping ) includes/wallet-gateway.php:167
  27. xMoney Payments icon xMoney Payments20+ installs apply_filters( 'woocommerce_cart_needs_shipping', $needs_shipping ) includes/class-xmoney-payments-gateway.php:260
  28. BD Mobile Payments Gateway icon BD Mobile Payments Gateway10+ installs apply_filters( 'woocommerce_cart_needs_shipping', $needs_shipping ) includes/gateways/bkash/class-wc-gateway-bKash.php:155
  29. wp-shkeeper-plugin icon wp-shkeeper-plugin10+ installs apply_filters( 'woocommerce_cart_needs_shipping', $needs_shipping ) includes/class-wc-payment-gateway-shkeeper.php:163
  30. Qonnex Finance spread payment option for WooCommerce icon Qonnex Finance spread payment option for WooCommerce10+ installs apply_filters( 'woocommerce_cart_needs_shipping', $needs_shipping ) woocommerce-gateway-gespreid-betalen.php:100
  31. Subscriptions & Recurring Payments for WooCommerce icon Subscriptions & Recurring Payments for WooCommerce10+ installs apply_filters( 'woocommerce_cart_needs_shipping', $needs_shipping ) inc/payment-methods/awc-paypal/inc_files/class-awc-paypal-payment-methods-for-subscription.php:449
  32. Hoovi BNPL icon Hoovi BNPL10+ installs apply_filters( 'woocommerce_cart_needs_shipping', $needs_shipping ) src/Gateway.php:329
  33. PnP (Pick and Pay)  Payment Gateway For Woocommerce icon PnP (Pick and Pay) Payment Gateway For Woocommerce10+ installs apply_filters( 'woocommerce_cart_needs_shipping', $needs_shipping ) pnp.php:146
  34. Gateway Payougo Checkout icon Gateway Payougo Checkout10+ installs apply_filters( 'woocommerce_cart_needs_shipping', $needs_shipping ) includes/class-wc-gateway-pyg-plugin.php:460
  35. Pay by Cash for Woocommerce icon Pay by Cash for Woocommerce10+ installs apply_filters( 'woocommerce_cart_needs_shipping', $needs_shipping ) class-wc-gateway-pay-by-cash.php:121
  36. Invoice Payment icon Invoice Payment10+ installs apply_filters( 'woocommerce_cart_needs_shipping', $needs_shipping ) includes/Handlers/PaymentGateway.php:315
  37. Collect Payment Gateway Plugin for WooCommerce icon Collect Payment Gateway Plugin for WooCommerce10+ installs apply_filters( 'woocommerce_cart_needs_shipping', $needs_shipping ) includes/class-wc-gateway-collect.php:354
  38. Tonder icon TonderFewer than 10 installs apply_filters( 'woocommerce_cart_needs_shipping', $needs_shipping ) zplit-payment-for-woocommerce.php:159
  39. Buy Now Pay Later for WooCommerce icon Buy Now Pay Later for WooCommerceFewer than 10 installs apply_filters( 'woocommerce_cart_needs_shipping', $needs_shipping ) includes/postpaid.php:265
  40. E-Transfer Gateway icon E-Transfer GatewayFewer than 10 installs apply_filters( 'woocommerce_cart_needs_shipping', $needs_shipping ) gateway-interac.php:162

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.