Skip to content

Commit

Permalink
Merge pull request #35 from ReferralCandy/jasonn/fix-checkout-error
Browse files Browse the repository at this point in the history
Fixed checkout tracking code issue
  • Loading branch information
jsnullarc authored Sep 2, 2020
2 parents ed8dc78 + a1aabef commit 5871181
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
4 changes: 2 additions & 2 deletions includes/class-rc-order.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@ public function submit_purchase() {
$response = wp_safe_remote_post($endpoint, $params);

# only used to cross reference requests
error_log('ReferralCandy API#purchase params: ' . print_r($params['body'], true));
error_log('ReferralCandy API#purchase response: ' . print_r(json_decode($response['body']), true));
// error_log('ReferralCandy API#purchase params: ' . print_r($params['body'], true));
// error_log('ReferralCandy API#purchase response: ' . print_r(json_decode($response['body']), true));
}
}
}
4 changes: 2 additions & 2 deletions includes/class-wc-referralcandy-integration.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ public function __construct() {
add_action('woocommerce_update_options_integration_' . $this->id, [$this, 'process_admin_options']);
add_action('admin_notices', [$this, 'check_plugin_requirements']);
add_action('init', [$this, 'rc_set_referrer_cookie']);
add_action('wp_enqueue_scripts', [$this, 'render_tracking_code']);
add_action('save_post', [$this, 'add_referrer_id']);
add_action('template_redirect', [$this, 'render_tracking_code']);
add_action('woocommerce_thankyou', [$this, 'render_post_purchase_popup']);
add_action('woocommerce_order_status_' . $this->status_to, [$this, 'rc_submit_purchase'], 10, 1);

Expand Down Expand Up @@ -165,7 +165,7 @@ public function rc_submit_purchase($order_id) {
$rc_order->submit_purchase();
}

public function render_tracking_code($post) {
public function render_tracking_code() {
if (is_page($this->tracking_page) == true) {
$tracking_code = '<script type="text/javascript"> !function(d,s) { var rc = "//go.referralcandy.com/purchase/'. $this->app_id .'.js"; var js = d.createElement(s); js.src = rc; var fjs = d.getElementsByTagName(s)[0]; fjs.parentNode.insertBefore(js,fjs); }(document,"script"); </script>';
echo $tracking_code;
Expand Down
3 changes: 3 additions & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ We maintain a list of FAQs on our [help page](http://answers.referralcandy.com/)

== Changelog ==

= 2.2.4 =
* Fixed issue where there the tracking code is rendered before the html

= 2.2.3 =
* Fixed issue where the plugin uses the `rc_referrer_id` cookie even if non-existent

Expand Down
2 changes: 1 addition & 1 deletion woocommerce-referralcandy.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Author: ReferralCandy
* Author URI: http://www.referralcandy.com
* Text Domain: woocommerce-referralcandy
* Version: 2.2.3
* Version: 2.2.4
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down

0 comments on commit 5871181

Please sign in to comment.