Skip to content

Commit

Permalink
Merge pull request #368 from carstenjaksch/patch-1
Browse files Browse the repository at this point in the history
Fix order ID tracking for non-numerical IDs
  • Loading branch information
duracelltomi authored Nov 18, 2024
2 parents c364c1b + c190676 commit 480f20f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions integration/woocommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -783,7 +783,7 @@ function gtm4wp_woocommerce_thankyou( $order_id ) {
// Check whether this order has been already tracked before in this browser.
let gtm4wp_order_already_tracked = false;
if ( gtm4wp_orderid_tracked && ( ' . esc_js( $order->get_order_number() ) . ' == gtm4wp_orderid_tracked ) ) {
if ( gtm4wp_orderid_tracked && ( "' . esc_js( $order->get_order_number() ) . '" == gtm4wp_orderid_tracked ) ) {
gtm4wp_order_already_tracked = true;
}
Expand All @@ -798,9 +798,9 @@ function gtm4wp_woocommerce_thankyou( $order_id ) {
var gtm4wp_orderid_cookie_expire = new Date();
gtm4wp_orderid_cookie_expire.setTime( gtm4wp_orderid_cookie_expire.getTime() + (365*24*60*60*1000) );
var gtm4wp_orderid_cookie_expires_part = "expires=" + gtm4wp_orderid_cookie_expire.toUTCString();
document.cookie = "gtm4wp_orderid_tracked=" + ' . esc_js( $order->get_order_number() ) . ' + ";" + gtm4wp_orderid_cookie_expires_part + ";path=/";
document.cookie = "gtm4wp_orderid_tracked=" + "' . esc_js( $order->get_order_number() ) . '" + ";" + gtm4wp_orderid_cookie_expires_part + ";path=/";
} else {
window.localStorage.setItem( "gtm4wp_orderid_tracked", ' . esc_js( $order->get_order_number() ) . ' );
window.localStorage.setItem( "gtm4wp_orderid_tracked", "' . esc_js( $order->get_order_number() ) . '" );
}
</script>';

Expand Down

0 comments on commit 480f20f

Please sign in to comment.