WC_Gateway_Paypal::has_paypal_orderspublicWC 1.0

Checks if the store has at least one PayPal Standand order.

Method of the class: WC_Gateway_Paypal{}

No Hooks.

Returns

true|false.

Usage

$WC_Gateway_Paypal = new WC_Gateway_Paypal();
$WC_Gateway_Paypal->has_paypal_orders();

WC_Gateway_Paypal::has_paypal_orders() code WC 10.8.1

public function has_paypal_orders() {
	$paypal_orders = wc_get_orders(
		array(
			'limit'          => 1,
			'return'         => 'ids',
			'payment_method' => self::ID,
		)
	);

	return is_countable( $paypal_orders ) ? 1 === count( $paypal_orders ) : false;
}