woocommerce_cart_needs_payment хук-фильтрWC 1.0

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

Использование

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
-

Где вызывается хук

WC_Checkout::process_checkout()
woocommerce_cart_needs_payment
WC_Cart::needs_payment()
woocommerce_cart_needs_payment
woocommerce/includes/class-wc-checkout.php 1290
if ( apply_filters( 'woocommerce_cart_needs_payment', $order->needs_payment(), WC()->cart ) ) {
woocommerce/includes/class-wc-cart.php 1419
return apply_filters( 'woocommerce_cart_needs_payment', 0 < $this->get_total( 'edit' ), $this );

Где используется хук в WooCommerce

Использование не найдено.