Automattic\WooCommerce\Internal\Admin\Orders\MetaBoxes

OrderAttribution::output()publicWC 8.5.0

Output the attribution data metabox for the order.

Method of the class: OrderAttribution{}

No Hooks.

Return

null. Nothing (null).

Usage

$OrderAttribution = new OrderAttribution();
$OrderAttribution->output( $order );
$order(WC_Order) (required)
The order object.

Changelog

Since 8.5.0 Introduced.

OrderAttribution::output() code WC 9.6.0

public function output( WC_Order $order ) {
	$meta = $this->filter_meta_data( $order->get_meta_data() );

	$this->format_meta_data( $meta );

	// No more details if there is only the origin value - this is for unknown source types.
	$has_more_details = array( 'origin' ) !== array_keys( $meta );

	// For direct, web admin, or mobile app orders, also don't show more details.
	$simple_sources = array( 'typein', 'admin', 'mobile_app' );
	if ( isset( $meta['source_type'] ) && in_array( $meta['source_type'], $simple_sources, true ) ) {
		$has_more_details = false;
	}

	$template_data = array(
		'meta'             => $meta,
		'has_more_details' => $has_more_details,
	);
	wc_get_template( 'order/attribution-details.php', $template_data );
}