–Hidden comment

Use attributes in format region_from and region_to= to change the languages showing in language switcher.
Available regions are:
europe_from europe_to
asia_from asia_to
mideast_from mideast_to
america_from america_to

Example:
europe_from=0 europe_to=22 will put all languages (ordered in language switcher settings) from 1 to 21 to Europe region:
asia_from=22 asia_to=25 will put all languages from 23 to 24 (so only 2) into Asia region.

WooCommerce (WordPress module)

A free ecommerce plugin that allows you to sell anything.

This integration with WooCommerce is really easy as you can connect the two using the WordPress plugin. When installed, configure it to define what do you want to track and how.

You can track per product commissions, order ID and coupons.

If you want to (or have to) integrate WooCommerce manually, here’s a guide.

Order tracking

To track whole order, use the following code. Edit file wp-content/plugins/woocommerce/templates/checkout/thankyou.php and place the code below line:

<?php do_action( 'woocommerce_thankyou', $order->id ); ?>
<script id="pap_x2s6df8d" src="https://URL_TO_PostAffiliatePro/scripts/trackjs.js" type="text/javascript"></script>
<script type="text/javascript">
PostAffTracker.setAccountId('Account_ID');
var sale = PostAffTracker.createSale();
sale.setTotalCost('<?php echo ($order->order_total - $order->order_shipping); ?>');
sale.setOrderID('<?php echo $order->id; ?>');
sale.setCurrency('<?php echo $order->get_order_currency(); ?>');
PostAffTracker.register();
</script>

Note:

In case you use a custom theme for WooCommerce and the thankyou.php file is located there as well (/themes/your_custom_theme/woocommerce/checkout/thankyou.php), you have to integrate it instead of the default one.

If you want more detailed tracking, follow the next step instead of this one.

If you wish to take use of Lifetime Commissions plugin then right above:

PostAffTracker.register();

add this:

sale.setData1('<?php echo $order->billing_email; ?>');

or this:

sale.setData1('<?php echo $order->user_id; ?>');

Per product integration

If you want to track commissions per product, use this code instead the one form step 1. You have to place it to the same file, at the same place:

wp-content/plugins/woocommerce/templates/checkout/thankyou.php

right below this line:

<?php do_action( 'woocommerce_thankyou', $order->id ); ?>
<script id="pap_x2s6df8d" src="https://URL_TO_PostAffiliatePro/scripts/trackjs.js" type="text/javascript"></script>
<script type="text/javascript">
PostAffTracker.setAccountId('Account_ID');
<?php
  $i = 0;
  foreach ($order->get_items() as $item) {
    $itemprice = $item['line_total'];
    $couponCode = '';
    $_product = $order->get_product_from_item($item);
    $p = $_product->id;

		try { //if coupon has been used, set the last one in the setCoupon() parameter
			$coupon = $order->get_used_coupons();
			$couponToBeUsed = (count($coupon)>1 ? count($coupon)-1 : 0);

			if (isset($coupon[$couponToBeUsed])) {
				$itemcount = $order->get_item_count($type = '');
				$orderdiscount = $order->get_order_discount();

				if ($itemcount > 0) {
					$discountperitem = $orderdiscount / $itemcount;
					$itemprice = $item['line_total'] - $discountperitem;
				}
				$couponCode = $coupon[$couponToBeUsed];
			}
		}
		catch (Exception $e) {
			//echo "<!--Error: ".$e->getMessage()."-->";
		}

		if (!empty($_product->sku)) {
		  $p = $_product->sku;
		}

		echo "var sale".$i." = PostAffTracker.createSale();";
		echo "sale".$i.".setTotalCost('".$itemprice."');";
		echo "sale".$i.".setOrderID('".$order->id."($i)');";
		echo "sale".$i.".setProductID('".$p."');";
		echo "sale".$i.".setCurrency('".$order->get_order_currency()."');";
		echo "sale".$i.".setCoupon('".$couponCode."');";
		$i++;
  }
?>
PostAffTracker.register();
</script>

Save your changes. That’s it, your shop has been integrated.

If you want to take use of Lifetime Commissions plugin, then right below:

echo "sale".$i.".setCoupon('".$couponCode."');";

add this:

echo "sale".$i.".setData1('".$order->billing_email."');";

or this:

echo "sale".$i.".setData1('".$order->user_id."');";

Integration of PayPal module in WooCommerce – part 1

Find and edit the following file:

  • for WooCommerce 2.2.11 and lower: woocommerce/includes/gateways/paypal/class-wc-gateway-paypal.php
  • for WooCommerce 2.3.3 and higher: woocommerce/includes/gateways/paypal/includes/class-wc-gateway-paypal-request.php

You can edit the plugin files either using the Plugin editor in WordPress or you can access the files of your WP installation via FTP.

In the above mentioned file find the function get_paypal_args() function and within it find a line with:

'return' =>

and a line with:

'notify_url' =>

Change the found lines by adding a special code:

'return' => esc_url( add_query_arg( 'utm_nooverride', '1', $this->get_return_url( $order ) ) ).'&paypal=1', // Post Affiliate Pro integration snippet

'notify_url' => $this->notify_url.'?pap_custom='.$_POST['pap_custom'], // Post Affiliate Pro integration snippet

Integration of PayPal module in WooCommerce – part 2

  • for WooCommerce 2.2.11 and lower: in the same file (woocommerce/includes/gateways/paypal/class-wc-gateway-paypal.php), find function check_ipn_request_is_valid and into that function below the line of function check_ipn_request_is_valid add the code found in the box below
  • for WooCommerce 2.3.3 and higher: find and edit the file of (woocommerce/includes/gateways/paypal/includes/class-wc-gateway-paypal-ipn-handler.php) and in that file find the validate_ipn() function. Within that function find the following line:
if ( ! is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 && strstr( $response['body'], 'VERIFIED' ) ) {

and right below that line add the code found in the box below:

/* Post Affiliate Pro integration snippet */
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://URL_TO_PostAffiliatePro/plugins/PayPal/paypal.php?pap_custom='.$_GET['pap_custom']);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $_POST);
curl_exec($ch);
/* /Post Affiliate Pro integration snippet */

Save your work and continue with the next step.

Integration of PayPal module in WooCommerce – part 3

Edit the file: woocommerce/templates/checkout/form-checkout.php.

Find this line:

<?php do_action( 'woocommerce_checkout_order_review' ); ?>

and place this code below the line:

<!-- Post Affiliate Pro integration snippet -->
<input type="hidden" name="pap_custom" value="" id="pap_dx8vc2s5">
<script id="pap_x2s6df8d" src="https://URL_TO_PostAffiliatePro/scripts/notifysale.php" type="text/javascript">
</script>
<!-- /Post Affiliate Pro integration snippet -->

Integration of PayPal module in WooCommerce – part 4

If you only use PayPal as your payment integration, you can ignore this step.

To make sure the integration does not create duplicate orders (one from PayPal and one from the thank you page), we have to set the thank you page to ignore commissions for PayPal orders.

To do so, you have to modify the thank you page tracking code a little. First, edit the file woocommerce/templates/checkout/thankyou.php and find this line:

<?php do_action( 'woocommerce_thankyou', $order->id ); ?>

Place this code below that line:

<?php 

if (empty($_GET['paypal'])) :

?>

Now, below the last integration lines:

PostAffTracker.register();

</script>

Add this code:

<?php endif; ?>

That’s it. Save your work and the very last step is to activate your PayPal IPN handling plugin in your Post Affiliate Pro.

Integration with Stripe

If you want to integrated Stripe recurring payments, you can do it in few small steps. First of all, you should have followed the step 1 or 2 and also using the customer email in data1:

sale.setData1('<?php echo $order->billing_email; ?>');

To make Stripe let your PAP know about a recurring payment, you have to add a new webhook in your Stripe account, Your Account (top right)> Account Settings> Webhooks … use this URL:

https://URL_TO_PostAffiliatePro/plugins/Stripe/stripe.php

Besides this, you have to enable (and configure) the Stripe plugin and Lifetime Commissions plugin.

Do not forget to insert the click tracking code to your WP header or footer file, using Appearance menu.

NOTE:
In case the sale tracking does not work for you event the sale tracking code is at it’s place, check if there is a special directory for woocommerce in your custom theme. If you found it, just integrate the /checkout/thankyou.php file there
.

Back to Integrations Create account for FREE
Integration Methods - Corecommerce

Integration Methods - Corecommerce

The article discusses various integrations available for Post Affiliate Pro to improve affiliate software. It also covers the product pricing, features, support, and knowledge base. The company provides templates, an affiliate marketing academy, and a glossary to help users. Additionally, they offer an affiliate program directory and newsletter subscription. The text includes a message about the Post Affiliate Pro account installation status and the use of cookies on the website. Finally, there is an invitation to schedule a call to learn more about how Post Affiliate Pro can benefit business.

Integration Methods - Amember V4

Integration Methods - Amember V4

The given text includes information about a company, its product, pricing, features, integrations, alternatives, support, knowledge base, member's area, change log, performance status, awards, customer reviews, affiliate program, list of resellers, blog, templates, affiliate marketing academy, glossary, program directory, and social media. It also mentions the terms of service, security policy, privacy policy, and GDPR. The text includes a message about the installation of a product and a call to schedule a one-on-one call to discuss the benefits of the product. It also provides contact details for the company, including a contact form, messenger, and live chat. The website uses cookies, and permission is needed before using some of the features.

Integration Methods - Lime Light

Integration Methods - Lime Light

The text explains the process of adding tracking codes to an ecommerce platform called Zoey using PostAffiliate Pro. It outlines the steps for integrating the order form, activating a URL for notifications, enabling automatic affiliate creation, tracking refunds, and enabling the plugin for Lime Light. The article also provides code snippets for each tracking method and encourages readers to create a free account. Additionally, the text discusses updates made to Post Affiliate Pro and highlights two affiliate programs.

Integration Methods - Foxycart

Integration Methods - Foxycart

The article discusses integration options for tracking transactions and coupons in the e-commerce platform Foxy Cart using PostAffiliate Pro. The integration options include tracking the entire cart as one transaction, tracking each product as a separate transaction, and utilizing coupon tracking. The article provides code snippets for each integration option. Foxy Cart is a hosted e-commerce solution designed for web developers. The article emphasizes the ease and reliability of using PostAffiliate Pro for tracking and data analysis.

Our website uses cookies. By continuing we assume your permission to deploy cookies as detailed in our privacy and cookies policy.

×

Schedule a one-on-one call and discover how Post Affiliate Pro can benefit your business.

We’re available on multiple dates

Schedule a call