WordPress at Your Fingertips
function is not described

WC_Product_Data_Store_CPT::get_starting_sales() public WC 3.0.0

Returns an array of IDs of products that have sales starting soon.

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

No Hooks.

Return

Array.

Usage

$WC_Product_Data_Store_CPT = new WC_Product_Data_Store_CPT();
$WC_Product_Data_Store_CPT->get_starting_sales();

Changelog

Since 3.0.0 Introduced.

Code of WC_Product_Data_Store_CPT::get_starting_sales() WC 5.8.0

public function get_starting_sales() {
	global $wpdb;

	// phpcs:ignore WordPress.VIP.DirectDatabaseQuery.DirectQuery
	return $wpdb->get_col(
		$wpdb->prepare(
			"SELECT postmeta.post_id FROM {$wpdb->postmeta} as postmeta
			LEFT JOIN {$wpdb->postmeta} as postmeta_2 ON postmeta.post_id = postmeta_2.post_id
			LEFT JOIN {$wpdb->postmeta} as postmeta_3 ON postmeta.post_id = postmeta_3.post_id
			WHERE postmeta.meta_key = '_sale_price_dates_from'
				AND postmeta_2.meta_key = '_price'
				AND postmeta_3.meta_key = '_sale_price'
				AND postmeta.meta_value > 0
				AND postmeta.meta_value < %s
				AND postmeta_2.meta_value != postmeta_3.meta_value",
			time()
		)
	);
}