Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Garconis/83b16d3a7cbd211e0342ee631e03c886 to your computer and use it in GitHub Desktop.
Save Garconis/83b16d3a7cbd211e0342ee631e03c886 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' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment