| Server IP : 146.59.209.152 / Your IP : 216.73.216.46 Web Server : Apache System : Linux webm005.cluster131.gra.hosting.ovh.net 5.15.167-ovh-vps-grsec-zfs-classid #1 SMP Tue Sep 17 08:14:20 UTC 2024 x86_64 User : infrafs ( 43850) PHP Version : 8.2.29 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/infrafs/www/wp-content/plugins/woocommerce/includes/tracks/events/ |
Upload File : |
<?php
/**
* WooCommerce Order Tracking
*
* @package WooCommerce\Tracks
*/
defined( 'ABSPATH' ) || exit;
/**
* This class adds actions to track usage of a WooCommerce Order.
*/
class WC_Order_Tracking {
/**
* Init tracking.
*/
public function init() {
add_action( 'woocommerce_admin_order_data_after_order_details', array( $this, 'track_order_viewed' ) );
}
/**
* Send a Tracks event when an order is viewed.
*
* @param WC_Order $order Order.
*/
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 );
}
}