Automattic\WooCommerce\Internal\Admin\Reports

HposLegacyOrderReportQueryBuilder::build_parent_order_status_where_clause │ private │ WC 1.0

Build the WHERE fragment that filters by the parent order's status.

Method of the class: HposLegacyOrderReportQueryBuilder{}

No Hooks.

Returns

string. WHERE fragment.

Usage

// private - for code of main (parent) class only
$result = $this->build_parent_order_status_where_clause( $parent_order_status, $order_status );
$parent_order_status(array) (required)
Status slugs without wc- prefix.
$order_status(array|false) (required)
If non-empty, parent-status NULL is allowed.

HposLegacyOrderReportQueryBuilder::build_parent_order_status_where_clause() code WC 11.1.2

private function build_parent_order_status_where_clause( $parent_order_status, $order_status ) {
	$statuses_in = "'wc-" . implode( "','wc-", $parent_order_status ) . "'";

	if ( ! empty( $order_status ) ) {
		return " AND ( parent_orders.status IN ( {$statuses_in} ) OR parent_orders.id IS NULL ) ";
	}

	return " AND parent_orders.status IN ( {$statuses_in} ) ";
}