WordPress Affiliate Manager

Affiliates Management Plugin for WordPress

  • Home
  • Features
    • Screen Shots
  • Download
  • Documentation
  • Addons
  • Support
    • Support Forum
    • Forum Login
    • Forum Registration
    • Contact
    • Premium Addon/Plugin Support
You are here: Home

Jim

  • Profile
  • Topics Started
  • Replies Created
  • Engagements
  • Favorites

Forum Replies Created

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • July 14, 2018 at 5:31 pm in reply to: ERROR: User already has an account and is already an affiliate #3795
    Jim
    Participant

    I eventually hacked into the DB to fix the issue: delete the affiliate record, register a new affiliate, and change the email and user Id in the affiliate table.

    This solved the issue for now.

    I do have a remaining question:

    what are the differences between the free WPAM, and paid version? Are they the same version s/w just different support?

    I wonder if I should upgrade to the paid version but wanna understand the value it offers.

    July 12, 2018 at 3:12 am in reply to: ERROR: User already has an account and is already an affiliate #3790
    Jim
    Participant

    Update: other pending affiliates have been approved ok. There is just one account that’s showing this error message. Please provide guidance on why this is happening, and how to fix it or workaround it. It’s a much smaller issue now. 🙂

    July 12, 2018 at 2:28 am in reply to: ERROR: User already has an account and is already an affiliate #3789
    Jim
    Participant

    Are there any manual workarounds to approve the pending affiliate accounts? through WP user management, or directly modifying the DB? How to trigger the approval email?

    We currently have about a dozen pending affiliates to approve. We’ll have to turn on auto-approval as a workaround for now.

    July 12, 2018 at 12:34 am in reply to: ERROR: User already has an account and is already an affiliate #3788
    Jim
    Participant

    I ran into the exact same error. A user with a wordpress user account applied for WPAM affiliate account, the setting is set to manually approve affiliates. When admin approves the user by clicking “Appove” button on this account, and enters the affiliate rate, the system reported this error:

    ERROR: User already has an account and is already an affiliate

    True. The user has an account pending approval but it can’t get approved. We’re stuck. Please help us out!

    One more question: what are the differences between the free WPAM, and paid version? Are they the same version s/w just different support?

    June 23, 2018 at 5:06 am in reply to: Does WPAM has protections against bots on login and registration page? #3732
    Jim
    Participant

    Thank you! I’ll look into it. Other than Google Recaptcha are there any other alternatives? Google is blocked in some parts of the world.

    June 14, 2018 at 11:57 pm in reply to: Recurring subscription switch(upgrade/downgrade) breaks the affiliate link? #3693
    Jim
    Participant

    Hi Shadow Labs, mbrsolution, wp.insider, affmngr

    I’ve done some digging and came up with fixes in the addon to the issue reported:
    1. Subscription upgrade (Switch) triggered gap payments are not rewarded to the affiliate.
    2. Renewals after the upgrade don’t seem to be rewarded to affiliate.

    Issue #1 is addressed by adding a new hook which takes care of the gap payment at time of switch complete:
    add_action(‘woocommerce_subscriptions_switch_completed’,’wpam_woocommerce_subscriptions_switch_completed’,20,1);
    The hook will do things similar to the existing wpam_woocommerce_subscription_payment_complete.

    Issue #2 is actually not as bad. It only skips the renewals because I rushed the renewals on the same day of the initial subscription. As a result, the txn_id (parent oder ID + date) is the same as the key of the previous record, and got dropped silently when the plugin tried to insert it into DB. So I changed the hook logic a little to use renewal order id instead of the parent order id to build the txn_id.

    With both fixes in, the issues seem to have been fixed.

    I’m attaching the code as a reference. The fixes are only focusing on my specific needs. I trust you guys can come up with the right solution for the plugin. Please let me know the next release.

    Thanks,
    Jim

    affiliatemgr-wc-subscription-integration.php:

    add_action(‘woocommerce_subscriptions_switch_completed’,’wpam_woocommerce_subscriptions_switch_completed’,20,1);
    function wpam_woocommerce_subscriptions_switch_completed($order) {
    WPAM_Logger::log_debug(‘WooCommerce Subscription Integration – woocommerce_subscriptions_switch_completed hook triggered’);

    $subscriptions = wcs_get_subscriptions_for_order($order);
    $theSub=null;
    foreach($subscriptions as $subscription) {
    $sub_status = $subscription->get_status();
    WPAM_Logger::log_debug(“WooCommerce Subscription Integration – subscription:” . $subscription->get_id() . ” status: ” . $sub_status);
    // only one activate sub can be tied to an order.
    if (strtolower($sub_status) == “active”) {
    // this is our sub
    $theSub=$subscription;
    break;
    }
    }

    $parent_order_id=$theSub->get_parent_id();
    $parent_order=wc_get_order($parent_order_id);

    $order_id = $order->get_id(); //an alternative is to use $subscription->get_parent_id(). old method: $order->id or $subscription->order->id;
    //WPAM_Logger::log_debug(‘WooCommerce Subscription Integration – Parent Order ID: ‘.$order_id.’, Subscription Total: ‘.$subscription->get_total().’, Total: ‘.$order->order_total);
    $total = $order->get_total(); //$order->order_total is better for a new subscription payment since it contains the actual amount charged. It also works well when there is a free trial.

    $shipping = $order->get_total_shipping();
    $tax = $order->get_total_tax();
    WPAM_Logger::log_debug(‘WooCommerce Subscription Integration – Order ID: ‘.$order_id.’, Total amount: ‘ . $total . ‘, Total shipping: ‘ . $shipping . ‘, Total tax: ‘ . $tax);
    WPAM_Logger::log_debug(‘WooCommerce Subscription Integration – Subscription ID: ‘ . $theSub->get_id());
    WPAM_Logger::log_debug(‘WooCommerce Subscription Integration – Parent Order ID: ‘ . $parent_order_id);
    $purchaseAmount = $total – $shipping – $tax;
    $wpam_refkey = get_post_meta($parent_order_id, ‘_wpam_refkey’, true);
    $wpam_id = get_post_meta($parent_order_id, ‘_wpam_id’, true);
    if(!empty($wpam_id)){
    $wpam_refkey = $wpam_id;
    }
    $wpam_refkey = apply_filters( ‘wpam_woo_override_refkey’, $wpam_refkey, $parent_order);
    if (empty($wpam_refkey)) {
    WPAM_Logger::log_debug(“WooCommerce Subscription Integration – could not get wpam_id/wpam_refkey from cookie. This is not an affiliate sale”);
    return;
    }
    $order_status = $parent_order->get_status();
    WPAM_Logger::log_debug(“WooCommerce Subscription Integration – Order status: ” . $order_status);
    if (strtolower($order_status) != “completed” && strtolower($order_status) != “processing”) {
    WPAM_Logger::log_debug(“WooCommerce Subscription Integration – Order status for this transaction is not in a ‘completed’ or ‘processing’ state. Commission will not be awarded at this stage.”);
    WPAM_Logger::log_debug(“WooCommerce Subscription Integration – Commission for this transaciton will be awarded when you set the order status to completed or processing.”);
    return;
    }
    //$txn_id = $order_id . “_” . date(“Y-m-d”); //Add the subscription charge date to make this unique
    $txn_id = $order_id . “_” . date(“Y-m-d”); //Add the subscription charge date to make this unique
    $requestTracker = new WPAM_Tracking_RequestTracker();
    //WPAM_Logger::log_debug(‘WooCommerce Subscription Integration – awarding commission for order ID: ‘ . $order_id . ‘, Purchase amount: ‘ . $purchaseAmount);
    WPAM_Logger::log_debug(‘WooCommerce Subscription Integration – awarding commission for witch order ID: ‘ . $order_id . ‘, Purchase amount: ‘ . $purchaseAmount);
    $requestTracker->handleCheckoutWithRefKey($txn_id, $purchaseAmount, $wpam_refkey);
    }

    add_action(‘woocommerce_subscription_payment_complete’, ‘wpam_woocommerce_subscription_payment_complete’); //Triggered when a subscription payment is made

    function wpam_woocommerce_subscription_payment_complete($subscription) {
    WPAM_Logger::log_debug(‘WooCommerce Subscription Integration – woocommerce_subscription_payment_complete hook triggered’);
    if (!is_object($subscription)) {
    $subscription = new WC_Subscription($subscription);
    }
    $order = $subscription->get_parent(); //Getting an instance of the related WC_Order object old method: $subscription->order;
    if (!is_object($order)) {
    $order = new WC_Order($order);
    }
    $order_id = $order->get_id(); //an alternative is to use $subscription->get_parent_id(). old method: $order->id or $subscription->order->id;
    //WPAM_Logger::log_debug(‘WooCommerce Subscription Integration – Parent Order ID: ‘.$order_id.’, Subscription Total: ‘.$subscription->get_total().’, Total: ‘.$order->order_total);
    $total = $subscription->get_total();
    $relatedOrders = $subscription->get_related_orders();
    if (count($relatedOrders) == 1) { //new subscription payment notification
    $total = $order->get_total(); //$order->order_total is better for a new subscription payment since it contains the actual amount charged. It also works well when there is a free trial.
    }
    $shipping = $order->get_total_shipping();
    $tax = $order->get_total_tax();
    WPAM_Logger::log_debug(‘WooCommerce Subscription Integration – Parent Order ID: ‘.$order_id.’, Total amount: ‘ . $total . ‘, Total shipping: ‘ . $shipping . ‘, Total tax: ‘ . $tax);
    $purchaseAmount = $total – $shipping – $tax;
    $wpam_refkey = get_post_meta($order_id, ‘_wpam_refkey’, true);
    $wpam_id = get_post_meta($order_id, ‘_wpam_id’, true);
    if(!empty($wpam_id)){
    $wpam_refkey = $wpam_id;
    }
    $wpam_refkey = apply_filters( ‘wpam_woo_override_refkey’, $wpam_refkey, $order);
    if (empty($wpam_refkey)) {
    WPAM_Logger::log_debug(“WooCommerce Subscription Integration – could not get wpam_id/wpam_refkey from cookie. This is not an affiliate sale”);
    return;
    }
    $order_status = $order->get_status();
    WPAM_Logger::log_debug(“WooCommerce Subscription Integration – Order status: ” . $order_status);
    if (strtolower($order_status) != “completed” && strtolower($order_status) != “processing”) {
    WPAM_Logger::log_debug(“WooCommerce Subscription Integration – Order status for this transaction is not in a ‘completed’ or ‘processing’ state. Commission will not be awarded at this stage.”);
    WPAM_Logger::log_debug(“WooCommerce Subscription Integration – Commission for this transaciton will be awarded when you set the order status to completed or processing.”);
    return;
    }
    //$txn_id = $order_id . “_” . date(“Y-m-d”); //Add the subscription charge date to make this unique
    $txn_id = $subscription->get_last_order() . “_” . date(“Y-m-d”); //Add the subscription charge date to make this unique
    $requestTracker = new WPAM_Tracking_RequestTracker();
    //WPAM_Logger::log_debug(‘WooCommerce Subscription Integration – awarding commission for order ID: ‘ . $order_id . ‘, Purchase amount: ‘ . $purchaseAmount);
    WPAM_Logger::log_debug(‘WooCommerce Subscription Integration – awarding commission for order ID: ‘ . $subscription->get_last_order() . ‘, Purchase amount: ‘ . $purchaseAmount);
    $requestTracker->handleCheckoutWithRefKey($txn_id, $purchaseAmount, $wpam_refkey);
    }

    June 9, 2018 at 1:34 am in reply to: Recurring subscription switch(upgrade/downgrade) breaks the affiliate link? #3678
    Jim
    Participant

    Any findings?

    June 3, 2018 at 7:26 pm in reply to: Recurring subscription switch(upgrade/downgrade) breaks the affiliate link? #3671
    Jim
    Participant

    Those switchable subscriptions are in the same group to allow them to switch. Here’s the documentation: https://docs.woocommerce.com/document/subscriptions/switching-guide/

    June 3, 2018 at 7:20 pm in reply to: Recurring subscription switch(upgrade/downgrade) breaks the affiliate link? #3670
    Jim
    Participant

    Variable subscriptions are setup this way on our site:
    Several levels of subscriptions are setup based on data limits: level 0-4;
    Each subscription is variable recurring monthly, or yearly

    Users can choose say the level 1 subscription and select monthly. Later they might want to choose to upgrade to the more expensive level 2. They’ll go to their account page under Subscriptions to pick this current subscription, and click the “Switch Subscription” button and then choose level 2 subscription, pay the gap payment, and the upgraded subscription would take effect immediately.

    Site is setup to allow upgrades/downgrades, but only prorate upgrade, which means upgrade takes effect immediately but downgrade won’t happen until the next payment date of the current subscription.

    I hope this helps.

    June 1, 2018 at 2:36 am in reply to: some minor issues i18N #3659
    Jim
    Participant

    Found a couple more on email subjects not i18N ready (fixed code pasted):
    1. line 105 of CommissionTracking.php: $subject = __(“You just earned a commission!”, ‘affiliates-manager’);
    2. line 50 of EmailHandler.php: $subject = sprintf(__(“Affiliate Application for %s”, ‘affiliates-manager’), $blogname);

    May 31, 2018 at 9:16 pm in reply to: Recurring subscription switch(upgrade/downgrade) breaks the affiliate link? #3657
    Jim
    Participant

    Hi Shadow Labs,

    Thanks for your response!

    I did some more digging, looks like the addon correctly identified the Switch Subscription/Upgrade order. But somehow the award is never showing up on the affiliate’s account after it says “recurring payemnt api call” as the last one in the below log message.

    Something seems to be missing here.

    Could you please look into this?
    Thanks,
    Jim

    [05/31/2018 9:04 PM] – SUCCESS : WooCommerce Integration – Saving wpam_id (1) with order. Order ID: 1914
    [05/31/2018 9:04 PM] – SUCCESS : WooCommerce Integration – Order processed. Order ID: 1914
    [05/31/2018 9:04 PM] – SUCCESS : WooCommerce Integration – Checking if affiliate commission needs to be awarded.
    [05/31/2018 9:04 PM] – SUCCESS : WooCommerce Integration – Order CPT name: %e8%ae%a2%e5%8d%95-may-31-2018-0904-pm
    [05/31/2018 9:04 PM] – SUCCESS : WooCommerce Integration – Order status: pending
    [05/31/2018 9:04 PM] – NOTICE : WooCommerce Integration – Order status for this transaction is not in a ‘completed’ or ‘processing’ state. Commission will not be awarded at this stage.
    [05/31/2018 9:04 PM] – NOTICE : WooCommerce Integration – Commission for this transaction will be awarded when you set the order status to completed or processing.
    [05/31/2018 9:04 PM] – SUCCESS : WooCommerce Integration – Order processed. Order ID: 1914
    [05/31/2018 9:04 PM] – SUCCESS : WooCommerce Integration – Checking if affiliate commission needs to be awarded.
    [05/31/2018 9:04 PM] – NOTICE : WooCommerce Integration – This is a subscription payment order since the _subscription_switch_data meta is set.
    [05/31/2018 9:04 PM] – NOTICE : The commission will be calculated via the recurring payemnt api call.

    May 30, 2018 at 6:08 am in reply to: Recurring subscription switch(upgrade/downgrade) breaks the affiliate link? #3653
    Jim
    Participant

    Hi Shadow Labs,

    I replied to an email on 5/25, and also got a reply from mbrsolution as well. I hope this is the one you are referring to. Let me know if we are not talking about the same message.

    I’m very happy with the timely response on the updated addon. I thank you guys for doing a great job!

    The issue/question I raised in the above message may or may not be related to the addon though. It might be within the WPAM itself.

    Thanks again!
    Jim

    May 25, 2018 at 7:41 pm in reply to: Affiliate Manager WooCommerce Subscription Integration update? #3631
    Jim
    Participant

    Appreciate it! Installed it. The warning messages in log doesn’t show up any more.

    May 22, 2018 at 5:48 am in reply to: QR code for the affiliate link such as /?wpam_id=1? #3621
    Jim
    Participant

    Are there any hooks we can use to implement a QR code inside Affiliate Manager?

  • Author
    Posts
Viewing 14 posts - 1 through 14 (of 14 total)

Featured Addons

  • WooCommerce Coupon Tracking
  • WooCommerce Product Specific Commission

Copyright © 2026 | WordPress Affiliate Manager | Privacy Policy