Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
WC_Coupon_Data_Store_CPT::get_tentative_usage_query( int $coupon_id )
Generate query to calculate tentative usages for the coupon.
Description Description
Parameters Parameters
- $coupon_id
-
(Required) Coupon ID to get tentative usage query for.
Return Return
(string) Query for tentative usages.
Source Source
File: includes/data-stores/class-wc-coupon-data-store-cpt.php
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. }