diff --git a/README.txt b/README.txt index 69e4718..bdac595 100644 --- a/README.txt +++ b/README.txt @@ -69,6 +69,7 @@ Yes. How t = 2.1.24 = * Added Order paid completed webhook +* Added cart_hash key to webhooks = 2.1.23 = * Fix purchase event diff --git a/includes/class-gtm-server-side-webhook-completed.php b/includes/class-gtm-server-side-webhook-completed.php index db9ddad..080444e 100644 --- a/includes/class-gtm-server-side-webhook-completed.php +++ b/includes/class-gtm-server-side-webhook-completed.php @@ -50,6 +50,7 @@ public function woocommerce_order_status_completed( $order_id ) { $request = array( 'event' => 'order_completed', + 'cart_hash' => $order->get_cart_hash(), 'ecommerce' => array( 'transaction_id' => esc_attr( $order->get_order_number() ), 'affiliation' => '', diff --git a/includes/class-gtm-server-side-webhook-processing.php b/includes/class-gtm-server-side-webhook-processing.php index eed7c17..a64f4b4 100644 --- a/includes/class-gtm-server-side-webhook-processing.php +++ b/includes/class-gtm-server-side-webhook-processing.php @@ -50,6 +50,7 @@ public function woocommerce_order_status_processing( $order_id ) { $request = array( 'event' => 'order_paid', + 'cart_hash' => $order->get_cart_hash(), 'ecommerce' => array( 'transaction_id' => esc_attr( $order->get_order_number() ), 'affiliation' => '', diff --git a/includes/class-gtm-server-side-webhook-purchase.php b/includes/class-gtm-server-side-webhook-purchase.php index 2b001d6..23d3af3 100644 --- a/includes/class-gtm-server-side-webhook-purchase.php +++ b/includes/class-gtm-server-side-webhook-purchase.php @@ -50,6 +50,7 @@ public function woocommerce_new_order( $order_id, $order ) { $request = array( 'event' => 'purchase', + 'cart_hash' => $order->get_cart_hash(), 'ecommerce' => array( 'transaction_id' => esc_attr( $order->get_order_number() ), 'affiliation' => '', diff --git a/includes/class-gtm-server-side-webhook-refund.php b/includes/class-gtm-server-side-webhook-refund.php index d204f26..7af9915 100644 --- a/includes/class-gtm-server-side-webhook-refund.php +++ b/includes/class-gtm-server-side-webhook-refund.php @@ -51,6 +51,7 @@ public function woocommerce_order_refunded( $order_id, $refund_id ) { $request = array( 'event' => 'refund', + 'cart_hash' => $order->get_cart_hash(), 'ecommerce' => array( 'transaction_id' => esc_attr( $order->get_order_number() ), 'value' => GTM_Server_Side_WC_Helpers::instance()->formatted_price( $order->get_total() ),