Automattic\WooCommerce\Internal\Admin\Orders\MetaBoxes

CustomerHistory::output()publicWC 1.0

Output the customer history template for the order.

Method of the class: CustomerHistory{}

No Hooks.

Return

null. Nothing (null).

Usage

$CustomerHistory = new CustomerHistory();
$CustomerHistory->output( $order ): void;
$order(WC_Order) (required)
The order object.

CustomerHistory::output() code WC 9.6.0

public function output( WC_Order $order ): void {
	// No history when adding a new order.
	if ( 'auto-draft' === $order->get_status() ) {
		return;
	}

	$customer_history = null;

	if ( method_exists( $order, 'get_report_customer_id' ) ) {
		$customer_history = $this->get_customer_history( $order->get_report_customer_id() );
	}

	if ( ! $customer_history ) {
		$customer_history = array(
			'orders_count'    => 0,
			'total_spend'     => 0,
			'avg_order_value' => 0,
		);
	}

	wc_get_template( 'order/customer-history.php', $customer_history );
}