Automattic\WooCommerce\Internal\DataStores\StockNotifications

StockNotificationsDataStore::get_distinct_datespublicWC 1.0

Get distinct notification creation dates.

Method of the class: StockNotificationsDataStore{}

No Hooks.

Returns

Array.

Usage

$StockNotificationsDataStore = new StockNotificationsDataStore();
$StockNotificationsDataStore->get_distinct_dates();

StockNotificationsDataStore::get_distinct_dates() code WC 10.3.6

public function get_distinct_dates() {

	global $wpdb;

	$results = $wpdb->get_results(
		$wpdb->prepare(
			'SELECT DISTINCT
				YEAR(date_created_gmt) AS year,
				MONTH(date_created_gmt) AS month
			FROM %i
			ORDER BY year DESC, month DESC',
			$this->get_table_name()
		)
	);

	return $results;
}