Automattic\WooCommerce\Internal\DataStores\Orders

OrdersTableQuery::process_orders_table_query_args()privateWC 1.0

Processes fields related to the orders table.

Method of the class: OrdersTableQuery{}

No Hooks.

Return

null. Nothing (null).

Usage

// private - for code of main (parent) class only
$result = $this->process_orders_table_query_args(): void;

OrdersTableQuery::process_orders_table_query_args() code WC 9.3.3

private function process_orders_table_query_args(): void {
	$this->sanitize_status();

	$fields = array_filter(
		array(
			'id',
			'status',
			'type',
			'currency',
			'tax_amount',
			'customer_id',
			'billing_email',
			'total_amount',
			'parent_order_id',
			'payment_method',
			'payment_method_title',
			'transaction_id',
			'ip_address',
			'user_agent',
		),
		array( $this, 'arg_isset' )
	);

	foreach ( $fields as $arg_key ) {
		$this->where[] = $this->where( $this->tables['orders'], $arg_key, '=', $this->args[ $arg_key ], $this->mappings['orders'][ $arg_key ]['type'] );
	}

	if ( $this->arg_isset( 'parent_exclude' ) ) {
		$this->where[] = $this->where( $this->tables['orders'], 'parent_order_id', '!=', $this->args['parent_exclude'], 'int' );
	}

	if ( $this->arg_isset( 'exclude' ) ) {
		$this->where[] = $this->where( $this->tables['orders'], 'id', '!=', $this->args['exclude'], 'int' );
	}

	// 'customer' is a very special field.
	if ( $this->arg_isset( 'customer' ) ) {
		$customer_query = $this->generate_customer_query( $this->args['customer'] );

		if ( $customer_query ) {
			$this->where[] = $customer_query;
		}
	}
}