Skip to content

Instantly share code, notes, and snippets.

@WPprodigy
Last active August 19, 2020 20:00
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save WPprodigy/c79b74c94d2fbb5e10c1 to your computer and use it in GitHub Desktop.
Save WPprodigy/c79b74c94d2fbb5e10c1 to your computer and use it in GitHub Desktop.
Add analytics tracking to the WooCommerce order received / thank-you page
/**
* Add Tracking Code to the Order Recieved Page
*/
function wc_ninja_checkout_analytics( $order_id ) {
$order = new WC_Order( $order_id );
$currency = $order->get_order_currency();
$total = $order->get_total();
$date = $order->order_date;
?>
<!-- Paste Tracking Code Under Here -->
<!-- End Tracking Code -->
<?php
}
add_action( 'woocommerce_thankyou', 'wc_ninja_checkout_analytics' );
@Garconis
Copy link

Is this still up to date with WordPress 3.0 changes?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment