Script not working with custom thankyou page plugin
-
Hello
I use your plugin “CUSTOM THANK YOU PAGE”. This overwrite or replace the standard Woo checkoutpage.
I need to load a script on the checkout page to enable the affiliate tracking. See below:
https://sc.tradetracker.net/implementation/overview?f%5Btarget%5D=merchant&f%5Bname%5D=General&f%5Bv…
This script is not working anymore with Custom thankyou page enabled. I hope you can help me to get this script working with your plugin enabled.I add the following codes to my WP
CODE1
to file: woocommerce/includes/wc-template-hooks.php
add_action(‘woocommerce_thankyou’, ‘tradetracker’);CODE 2
to file: /wp-includes/functions.php filefunction tradetracker($order_id)
{
$campaignID = ‘#ID’; // Enter your campaignID as provided by TradeTracker.
$productID = ‘#ID’; // Enter your productID as provided by TradeTracker.// *****************
$order = new WC_Order($order_id);
$transactionID = htmlentities($order_id, ENT_QUOTES);
$transactionAmount = htmlentities((float) $order->order_total – (float) $order->order_shipping – (float) $order->order_discount – (float) $order->order_tax);echo “<script type=\”text/javascript\”>
var ttConversionOptions = ttConversionOptions || [];
ttConversionOptions.push({
type: ‘sales’,
campaignID: ‘{$campaignID}’,
productID: ‘{$productID}’,
transactionID: ‘{$transactionID}’,
transactionAmount: ‘{$transactionAmount}’,
quantity: ‘1’,
descrMerchant: ”,
descrAffiliate: ”,
currency: ”
});
</script>
<noscript>
</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>”;
}The page I need help with: [log in to see the link]
- The topic ‘Script not working with custom thankyou page plugin’ is closed to new replies.