WC_Order_Tracking::track_order_viewed( WC_Order $order )

Send a Tracks event when an order is viewed.


Description Description


Parameters Parameters

$order

(Required) Order.


Top ↑

Source Source

File: includes/tracks/events/class-wc-order-tracking.php

	public function track_order_viewed( $order ) {
		if ( ! $order instanceof WC_Order || ! $order->get_id() ) {
			return;
		}
		$properties = array(
			'current_status' => $order->get_status(),
			'date_created'   => $order->get_date_created() ? $order->get_date_created()->format( DateTime::ATOM ) : '',
			'payment_method' => $order->get_payment_method(),
		);

		WC_Tracks::record_event( 'single_order_view', $properties );
	}


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.