woocommerce_order_needs_payment

The WooCommerce woocommerce order needs payment hook.

Description

apply_filters( 'woocommerce_order_needs_payment', (number) $this_has_status_valid_order_statuses_this_get_total_0, (unknown) $instance, (unknown) $valid_order_statuses ); 

Parameters (3)

0. $this_has_status_valid_order_statuses_this_get_total_0 (number) => ( $this->has_status( $valid_order_statuses ) && $this->get_total() > 0 )
The this has status valid order statuses this get total 0.
1. $instance (unknown)
The instance.
2. $valid_order_statuses (unknown)
The valid order statuses.

Usage

To run the hook, copy the example below.
  1. $this_has_status_valid_order_statuses_this_get_total_0 = apply_filters( 'woocommerce_order_needs_payment', $this_has_status_valid_order_statuses_this_get_total_0, $instance, $valid_order_statuses ); 
  2.  
  3. if ( !empty( $this_has_status_valid_order_statuses_this_get_total_0 ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the woocommerce_order_needs_payment callback 
  2. function filter_woocommerce_order_needs_payment( $this_has_status_valid_order_statuses_this_get_total_0, $instance, $valid_order_statuses ) { 
  3. // make filter magic happen here... 
  4. return $this_has_status_valid_order_statuses_this_get_total_0
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'woocommerce_order_needs_payment', 'filter_woocommerce_order_needs_payment', 10, 3 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'woocommerce_order_needs_payment', 'filter_woocommerce_order_needs_payment', 10, 3 ); 

Defined (1)

The filter is defined in the following location(s).

/includes/class-wc-order.php  
  1. return apply_filters( 'woocommerce_order_needs_payment', ( $this->has_status( $valid_order_statuses ) && $this->get_total() > 0 ), $this, $valid_order_statuses );