From 5b99991b7f95b6c8dc63dfc3da633716d491b5c7 Mon Sep 17 00:00:00 2001 From: Malith Senaweera <6216000+malithsen@users.noreply.github.com> Date: Mon, 4 Mar 2024 09:31:56 +0530 Subject: [PATCH 1/2] Revert "Include payment title in order_placed Tracks event (#8252)" This reverts commit 530783fe131414f5189259aed5dc862ad89f7d74. --- changelog/add-track-gateway-name | 4 ---- includes/class-woopay-tracker.php | 18 ++++-------------- 2 files changed, 4 insertions(+), 18 deletions(-) delete mode 100644 changelog/add-track-gateway-name diff --git a/changelog/add-track-gateway-name b/changelog/add-track-gateway-name deleted file mode 100644 index 96b74d17674..00000000000 --- a/changelog/add-track-gateway-name +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: dev - -Include gateway name in order-placed Tracks event diff --git a/includes/class-woopay-tracker.php b/includes/class-woopay-tracker.php index 60d42df0990..6818bc0e01e 100644 --- a/includes/class-woopay-tracker.php +++ b/includes/class-woopay-tracker.php @@ -70,8 +70,8 @@ public function __construct( $http ) { add_action( 'woocommerce_after_single_product', [ $this, 'classic_product_page_view' ] ); add_action( 'woocommerce_blocks_enqueue_checkout_block_scripts_after', [ $this, 'blocks_checkout_start' ] ); add_action( 'woocommerce_blocks_enqueue_cart_block_scripts_after', [ $this, 'blocks_cart_page_view' ] ); - add_action( 'woocommerce_checkout_order_processed', [ $this, 'checkout_order_processed' ], 10, 2 ); - add_action( 'woocommerce_blocks_checkout_order_processed', [ $this, 'checkout_order_processed' ], 10, 2 ); + add_action( 'woocommerce_checkout_order_processed', [ $this, 'checkout_order_processed' ] ); + add_action( 'woocommerce_blocks_checkout_order_processed', [ $this, 'checkout_order_processed' ] ); add_action( 'woocommerce_payments_save_user_in_woopay', [ $this, 'must_save_payment_method_to_platform' ] ); add_action( 'before_woocommerce_pay_form', [ $this, 'pay_for_order_page_view' ] ); add_action( 'woocommerce_thankyou', [ $this, 'thank_you_page_view' ] ); @@ -463,21 +463,11 @@ public function pay_for_order_page_view() { /** * Record a Tracks event that the order has been processed. */ - public function checkout_order_processed( $order_id ) { + public function checkout_order_processed() { $is_woopay_order = ( isset( $_SERVER['HTTP_USER_AGENT'] ) && 'WooPay' === $_SERVER['HTTP_USER_AGENT'] ); - - $payment_gateway = wc_get_payment_gateway_by_order( $order_id ); - $properties = [ 'payment_title' => 'other' ]; - - if (strpos( $payment_gateway->id, 'woocommerce_payments') === 0 ) { - $order = wc_get_order( $order_id ); - $payment_title = $order->get_payment_method_title(); - $properties = [ 'payment_title' => $payment_title ]; - } - // Don't track WooPay orders. They will be tracked on WooPay side with more flow specific details. if ( ! $is_woopay_order ) { - $this->maybe_record_wcpay_shopper_event( 'checkout_order_placed', $properties ); + $this->maybe_record_wcpay_shopper_event( 'checkout_order_placed' ); } } From f64b7dac8ececad75f88bd4995c46ddf6b705ad0 Mon Sep 17 00:00:00 2001 From: Malith Senaweera Date: Mon, 4 Mar 2024 09:45:33 +0530 Subject: [PATCH 2/2] Add changelog entry --- changelog/revert-8252-add-track-gateway-name | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 changelog/revert-8252-add-track-gateway-name diff --git a/changelog/revert-8252-add-track-gateway-name b/changelog/revert-8252-add-track-gateway-name new file mode 100644 index 00000000000..28b7cb7d7a9 --- /dev/null +++ b/changelog/revert-8252-add-track-gateway-name @@ -0,0 +1,5 @@ +Significance: patch +Type: dev +Comment: Reverts an unreleased change + +