woocommerce_cart_needs_payment
Note that woocommerce_cart_needs_payment is only used in WC_Checkout::process_checkout() to keep backwards compatibility. Use woocommerce_order_needs_payment instead.
Note that at this point you can't rely on the Cart Object anymore, since it could be empty see: https://github.com/woocommerce/woocommerce/issues/24631
Usage
add_filter( 'woocommerce_cart_needs_payment', 'wp_kama_woocommerce_cart_needs_payment_filter', 10, 2 ); /** * Function for `woocommerce_cart_needs_payment` filter-hook. * * @param $needs_payment * @param $WC()->cart * * @return */ function wp_kama_woocommerce_cart_needs_payment_filter( $needs_payment, $WC()->cart ){ // filter... return $needs_payment; }
- $needs_payment
- -
- $WC()->cart
- -
Where the hook is called
woocommerce_cart_needs_payment
woocommerce_cart_needs_payment
woocommerce/includes/class-wc-checkout.php 1321
if ( apply_filters( 'woocommerce_cart_needs_payment', $order->needs_payment(), WC()->cart ) ) {
woocommerce/includes/class-wc-cart.php 1420
return apply_filters( 'woocommerce_cart_needs_payment', 0 < $this->get_total( 'edit' ), $this );