
Wordpress ecommerce Plugin
Would you like to improve your affiliate software even more? Check out the WordPress ecommerce plugin for Post Affiliate Pro.
Integrate WooCommerce with Post Affiliate Pro using a WordPress plugin for tracking sales, products, and commissions. Follow detailed steps for PayPal and Stripe integrations, ensuring accurate affiliate tracking without duplicate orders.
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.
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; ?>');
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."');";
Find and edit the following file:
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](https://www.postaffiliatepro.com/ "Post Affiliate Pro offers a comprehensive affiliate software platform to manage multiple affiliate programs with ease. Enjoy no setup fees, 24/7 customer support, and a free 1-month trial. Ideal for small and large businesses, it features precise tracking, automated workflows, and customizable tools to boost your affiliate marketing success. Try it now and streamline your affiliate operations effortlessly!") integration snippet
'notify_url' => $this->notify_url.'?pap_custom='.$_POST['pap_custom'], // [Post Affiliate](https://www.postaffiliatepro.com/ "Post Affiliate Pro offers a comprehensive affiliate software platform to manage multiple affiliate programs with ease. Enjoy no setup fees, 24/7 customer support, and a free 1-month trial. Ideal for small and large businesses, it features precise tracking, automated workflows, and customizable tools to boost your affiliate marketing success. Try it now and streamline your affiliate operations effortlessly!") Pro integration snippet
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](https://www.postaffiliatepro.com/affiliate-marketing-glossary/affiliate/ "Discover the role of an affiliate in marketing—earn commissions by promoting products through banners, links, and campaigns. Learn how affiliates drive sales and explore effective marketing strategies. Join the world of affiliate marketing with Post Affiliate Pro for user-friendly tools and exceptional support.") 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](https://www.postaffiliatepro.com/affiliate-marketing-glossary/affiliate/ "Discover the role of an affiliate in marketing—earn commissions by promoting products through banners, links, and campaigns. Learn how affiliates drive sales and explore effective marketing strategies. Join the world of affiliate marketing with Post Affiliate Pro for user-friendly tools and exceptional support.") Pro integration snippet */
Save your work and continue with the next step.
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 -->
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.
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.
WooCommerce is a free, open-source eCommerce plugin designed specifically for WordPress, enabling users to transform their WordPress websites into fully functional online stores. Whether you’re selling physical products, digital goods, subscriptions, or memberships, WooCommerce provides a robust platform that supports a wide range of online retail operations. Highly extensible, it integrates seamlessly with WordPress and offers unparalleled flexibility and customization options for entrepreneurs and businesses looking to enhance their e-commerce capabilities.
Originally developed by WooThemes, WooCommerce has evolved significantly since its inception. In 2015, Automattic, the company behind WordPress.com, acquired WooCommerce, propelling its development to new heights. Over the years, WooCommerce has released several major updates and enhancements, solidifying its position as a dominant e-commerce platform within the WordPress ecosystem. Its journey is marked by continuous support and innovation driven by a global community of developers and users.
WooCommerce is tailored for individuals and businesses eager to establish online stores, ranging from small and medium-sized enterprises (SMEs) to entrepreneurs and large corporations already utilizing WordPress. It provides customizable and scalable solutions that convert WordPress websites into powerful e-commerce platforms. By leveraging WooCommerce, businesses can enhance their operations, improve scalability, and boost customer engagement through a feature-rich online store.
Pros:
Cons:
WooCommerce Review: The Best E-commerce Solution?
An in-depth analysis of WooCommerce’s features and usability.
WooCommerce vs Shopify: Which One’s Best For You?
A comparative review highlighting the strengths and weaknesses of WooCommerce relative to Shopify.
How To Use WooCommerce | eCommerce Tutorial for Beginners
A step-by-step guide for beginners on setting up and using WooCommerce.
If WooCommerce doesn’t perfectly fit your needs, consider these alternatives:
WooCommerce is a free, open-source eCommerce plugin for WordPress that enables users to transform their websites into fully functional online stores, supporting physical and digital goods, subscriptions, and memberships.
You can integrate WooCommerce with Post Affiliate Pro using the official WordPress plugin or by manually adding tracking code to your WooCommerce templates. The integration supports order tracking, per-product commissions, and can be extended to support PayPal and Stripe payments.
Yes, the integration offers step-by-step guidance to connect and track orders processed via PayPal and Stripe within WooCommerce and Post Affiliate Pro.
The core WooCommerce plugin is free to download and use. However, additional costs may apply for hosting, premium themes, plugins, or payment gateway fees.
WooCommerce offers versatile selling options, customizable store setup, support for 140+ payment gateways, efficient order management, a vast library of extensions, and multi-currency/multilingual support.
Alternatives to WooCommerce include Shopify, BigCommerce, Wix, Adobe Commerce (Magento), Shopify Buy Button, Ecwid, Easy Digital Downloads, and MemberPress.
Lucia is a talented content editor who ensures the seamless publication of content across multiple platforms.
Boost your affiliate marketing strategy by integrating WooCommerce with Post Affiliate Pro. Track orders, manage commissions, and connect with popular payment gateways effortlessly.
Would you like to improve your affiliate software even more? Check out the WordPress ecommerce plugin for Post Affiliate Pro.
Would you like to improve your affiliate software even more? Check out the ShopSite integration for Post Affiliate Pro.
Would you like to improve your affiliate software even more? Check out the Oxid Eshop integration for Post Affiliate Pro. Easily integrate Oxid Eshop with Post ...