Automattic\WooCommerce\Admin\API\Reports\Coupons

DataStore::normalize_order_by()protectedWC 1.0

Maps ordering specified by the user to columns in the database/fields in the data.

Method of the class: DataStore{}

No Hooks.

Return

String.

Usage

// protected - for code of main (parent) or child class
$result = $this->normalize_order_by( $order_by );
$order_by(string) (required)
Sorting criterion.

DataStore::normalize_order_by() code WC 7.3.0

protected function normalize_order_by( $order_by ) {
	if ( 'date' === $order_by ) {
		return 'time_interval';
	}
	if ( 'code' === $order_by ) {
		return '_coupons.post_title';
	}
	return $order_by;
}