“Get More WooCommerce Sales And Traffic”
OSI Affiliate Software offers the ability to easily and automatically track recurring sales when they are sent from your WooCommerce affiliate users to your WooCommerce Affiliate Program. Please follow our instructions below to see how to setup the automatic tracking recurring sales. If you are using a subscription system such as Stripe to automatically charge your customers on a recurring basis, do not follow the instructions below, however you should follow our Stripe integration instructions instead.
Step 1. Add this code to woocommerce thank you page before the </body> tag:
<?php
$order = wc_get_order($order);
$ot = $order->order_total;
$os = $order->order_shipping;
$final = $ot-$os;
$coupons = $order->get_items('coupon');
$PromoCode = '';
foreach($coupons as $coupon) {
$PromoCode = $coupon['name'];
break;
}
?>
<script>
function hideIF() {
document.getElementById('IF').style.display = '';
}
function getSaleInfo() {
document.getElementById('st_code').innerHTML='<iframe src="https://arlentest2.ositracker.com/sales/salejs/amount:<?php
echo $final; ?>/transaction:<?php
echo $order->id ?>/PromoCode:<?php
echo $PromoCode ?>/customer_email:<?php
echo $order->get_billing_email() ?>" alt="" id=IF width=50 height=50 border="0" frameborder="0" onload="hideIF()">';
}
window.onload = getSaleInfo;
</script>
<div id="st_code"></div>
Note: Make sure to replace https://arlentest2.ositracker.com with your actual OSI Affiliate Software domain.
Step 2. We need to add these lines in WP theme's functions.php file.
function osi_recurring( $subscription, $order ) {
$response = wp_remote_get( 'https://arlentest2.ositracker.com/sales/send_recurring?key=390db4e976f674cacae20ef0f696c20c&customer_email='.$order->get_billing_email().'&amount='.$order->get_total().'&transaction='.$order->get_order_number() );
}
add_action( 'woocommerce_subscription_renewal_payment_complete', 'osi_recurring', 10, 2 );
Note: Make sure to create your own key and replace 390db4e976f674cacae20ef0f696c20c
Replace https://arlentest2.ositracker.com with your actual OSI Affiliate Software domain.
To get your own key, follow the steps below:
Step 3. Login to your OSI Affiliate Software dashboard and click on your profile located at the bottom-left.
Step 4. Select Modify Profile.
Step 3. Copy the API User Token if the field is already filled or click on Regenerate API Key if it's blank.