Remove Customer Order Count from Order Attribution checkout data (#44359)

* Remove Customer Order Count from Checkout Tracks data
This commit is contained in:
Justin Palmer 2024-02-05 16:06:49 +01:00 committed by GitHub
parent a943de24fa
commit cd7f429bc1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 18 additions and 16 deletions

View File

@ -0,0 +1,4 @@
Significance: patch
Type: performance
Remove customer order count from order attribution checkout data.

View File

@ -421,8 +421,7 @@ class OrderAttributionController implements RegisterHooksInterface {
$source_data['utm_source'] ?? '',
false
);
$customer_identifier = $order->get_customer_id() ? $order->get_customer_id() : $order->get_billing_email();
$customer_info = $this->get_customer_history( $customer_identifier );
$tracks_data = array(
'order_id' => $order->get_id(),
'source_type' => $source_data['source_type'] ?? '',
@ -433,10 +432,9 @@ class OrderAttributionController implements RegisterHooksInterface {
'session_pages' => $source_data['session_pages'] ?? 0,
'session_count' => $source_data['session_count'] ?? 0,
'order_total' => $order->get_total(),
// Add 1 to include the current order (which is currently still Pending when the event is sent).
'customer_order_count' => $customer_info['order_count'] + 1,
'customer_registered' => $order->get_customer_id() ? 'yes' : 'no',
);
$this->proxy->call_static( WC_Tracks::class, 'record_event', 'order_attribution', $tracks_data );
}