How to Add Tradetracker on WordPress without a Plugin

Add the following codes to woocommerce thankyou.php to Add Tradetracker on WordPress without a Plugin

global $wp;
$order_id = absint( $wp->query_vars[‘order-received’] );
// WooCommerce order details
$order = wc_get_order($order_id);  // Get the WooCommerce order object
$transaction_id = $order->get_id();  // Get the WooCommerce order ID
$order_total = $order->get_total();  // Get the total amount of the order
$currency = get_woocommerce_currency();  // Get the order currency
$items = $order->get_items();  // Get all items in the order
// Your TradeTracker credentials
$customer_id = ‘******’;  // Replace with your actual customer ID
$passphrase = ‘*************************************’;  // Replace with your actual passphrase/verification code
// Get the first product in the order (for single product tracking)
$item = reset($items);  // Get the first item in the order
$product = $item->get_product();  // Get the product object
//$product_id = $product->get_id();  // Get the product ID
$product_id = “*****”;  // Get the product ID
$product_quantity = $item->get_quantity();  // Get the quantity ordered
$product_total = $item->get_total();  // Get the total price for this product (price * quantity)
?>
<!– TradeTracker Conversion Code for Single Product –>
<script type=”text/javascript”>
var ttConversionOptions = ttConversionOptions || [];
ttConversionOptions.push({
type: ‘sales’,
    campaignID: ‘*****’,  // Replace with your actual campaign ID
    productID: ‘<?php echo $product_id; ?>’,  // Dynamic product ID
    transactionID: ‘<?php echo $transaction_id; ?>’,  // Dynamic WooCommerce order ID
    transactionAmount: ‘<?php echo $product_total; ?>’,  // Dynamic product total (price * quantity)
    quantity: ‘<?php echo $product_quantity; ?>’,  // Dynamic quantity for the product
    descrMerchant: ”,  // Add any custom description if needed
    descrAffiliate: ”,  // Add affiliate description if needed
    vc: ‘<?php echo $passphrase; ?>’,  // Passphrase (verification code) for security
    currency: ‘<?php echo $currency; ?>’  // Dynamic currency
});
</script>
<noscript>
<img src=”//ts.tradetracker.net/?cid=<?php echo $customer_id; ?>&amp;pid=<?php echo $product_id; ?>&amp;tid=<?php echo $transaction_id; ?>&amp;tam=<?php echo $product_total; ?>&amp;data=&amp;qty=<?php echo $product_quantity; ?>&amp;descrMerchant=&amp;descrAffiliate=&amp;event=sales&amp;currency=<?php echo $currency; ?>&amp;vc=<?php echo $passphrase; ?>” alt=”” />
</noscript>
<script type=”text/javascript”>
(function(ttConversionOptions) {
var campaignID = ‘campaignID’ in ttConversionOptions ? ttConversionOptions.campaignID : (‘length’ in ttConversionOptions && ttConversionOptions.length ? ttConversionOptions[0].campaignID : null);
var tt = document.createElement(‘script’);
tt.type = ‘text/javascript’;
tt.async = true;
tt.src = ‘//tm.tradetracker.net/conversion?s=’ + encodeURIComponent(campaignID) + ‘&t=m’;
var s = document.getElementsByTagName(‘script’);
s = s[s.length – 1];
s.parentNode.insertBefore(tt, s);
})(ttConversionOptions);
</script>