WordPress at Your Fingertips
function is not described

WC_Coupon_Data_Store_CPT::get_tentative_usage_query() private WC 1.0

Generate query to calculate tentative usages for the coupon.

{} It's a method of the class: WC_Coupon_Data_Store_CPT{}

No Hooks.

Return

String. Query for tentative usages.

Usage

// private - for code of main (parent) class only
$result = $this->get_tentative_usage_query( $coupon_id );
$coupon_id(int) (required)
Coupon ID to get tentative usage query for.

Code of WC_Coupon_Data_Store_CPT::get_tentative_usage_query() WC 5.8.0

private function get_tentative_usage_query( $coupon_id ) {
	global $wpdb;
	return $wpdb->prepare(
		"
		SELECT COUNT(meta_id) FROM $wpdb->postmeta
		WHERE {$wpdb->postmeta}.meta_key like %s
		AND {$wpdb->postmeta}.meta_key > %s
		AND {$wpdb->postmeta}.post_id = %d
		FOR UPDATE
		",
		array(
			'_coupon_held_%',
			'_coupon_held_' . time(),
			$coupon_id,
		)
	);  // WPCS: unprepared SQL ok.
}