Last active
August 19, 2020 20:00
-
-
Save WPprodigy/c79b74c94d2fbb5e10c1 to your computer and use it in GitHub Desktop.
Add analytics tracking to the WooCommerce order received / thank-you page
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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
Is this still up to date with WordPress 3.0 changes?