Skip to content

Instantly share code, notes, and snippets.

@ben-heath
Created April 19, 2017 15:06
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ben-heath/3b1198c12651b4f3d52705562e85ffcc to your computer and use it in GitHub Desktop.
Save ben-heath/3b1198c12651b4f3d52705562e85ffcc to your computer and use it in GitHub Desktop.
WooCommerce Thank you page - Sharesale tracking image
// This code goes in the functions.php file of you're WP theme (child theme)
add_action('woocommerce_thankyou','sls_sharesale_tracking'); // hook for the thank you page
function sls_sharesale_tracking( $order_id ) { // pass in the order id
$order = new WC_Order( $order_id );
$currency = $order->get_order_currency();
$total = $order->get_total();
$date = $order->order_date;
echo '<img src="https://shareasale.com/sale.cfm?amount='.$total.'&tracking='.$order_id.'&transtype=sale&merchantID=MERCHANT_ID_GOES_HERE" width="1" height="1">';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment