• Resolved pwxynergy

    (@pwxynergy)


    Hi,

    My client has the pro-version of your plugin. It looks like there is a bug where the admin affiliate table is miscalculating the total commission for some affiliates. It appears that the plugin is summing up the total commission by adding the order commission price up once for each product-type in the order.

    For example, an affiliate referred someone to my client’s store. That customer placed an order for seven types of products in a single order. The commission should be $50.00. That is correctly reported in the order, but on the affiliate table it reports the total commission as $350, seven times as high as it should be.

    My guess is that this is being done on lines 95-99 of the class-pw-affiliate.php file:

    foreach ( $orders as $order ) {
      foreach ( $order->get_items( 'line_item' ) as $line_item ) {
        $total_commission += $line_item->get_meta( '_pw_affiliate_commission' );
      }
    }

    Looking at the database, _pw_affiliate_comission seems to hold the total commission for the whole order, and this is being added as many times as there are products.

    Is this where the bug is occurring? Is this something you can patch and release an update? I’m reluctant to go tinkering with the actual plugin code, and I entirely could have mis-diagnosed the guilty code. I appreciate any help you can give.

Viewing 1 replies (of 1 total)
  • Plugin Author pimwick

    (@pimwick)

    Hello, we received a direct email from you as well. We will correspond via email since WordPress.org prefers that we don’t offer support for the Pro plugins inside their forums. Thanks for your understanding!

Viewing 1 replies (of 1 total)
  • The topic ‘Affiliate table is miscalculating comission’ is closed to new replies.