Affiliates Enterprise

Tags

How do I set up a formula based commission calculation? Just upgraded to enterprise.

Fixed, percentage or formula based commissions
Referral amounts can be flat rates, percentage of net sales amounts and based on custom formulas.
These can be set in general and per affiliate.

5 Responses to Affiliates Enterprise

  1. Remmy Castillio January 11, 2019 at 7:04 pm #

    In spite of what you say in your first sentence above, I’m quite sure that we need a specific formula implemented. Please regard that as a ‘given’ in this particular incident, OK? Specifically, we need to run to run a calc that looks like this: Net sale of Woocommerce virtual product (membership) sales price: $1499 – $250 fixed cost = $1240 net * .3 = 374.70 commission – we need to do this as a formula rather then a fixed $374 commission as a Woo-managed coupon may be applied to the full $1499 price, but still need fixed cost deducted before 30% commission is applied to net after coupon and fixed-cost subtraction.

    So yes, I understand that your enterprise plugin will make the commission calculation on the net after applying a discount coupon. I also understand that it can calculate a commission percentage on the remainder. We have already adjusted the system to do just that. But as noted above and in previous msgs, we need the fixed cost we provide deducted before the final commission percentage is calculated.

    Is there a place in your code where I can add a filter, action or hook to change the net sale amount before the final commission is calculated? << SECOND time I've asked this question and I'd appreciate a direct answer this time around.

    Thanks for your kind help.

    • Kento January 24, 2019 at 12:09 pm #

      Hi Remmy,

      Thanks for providing this detailed explanation – there are two solutions that you will be able to apply, the first one is immediate, the second after our next version which is close to being released.

      #1 Use the action affiliates_referral that is triggered when a new referral is created to modify its values.
      #2 Additional features available as of 4.x that allow to compute the value before the referral is created persistently.

      To implement #1 you can base it on this outline:

      add_filter( 'affiliates_referral', 'my_affiliates_referral', 10, 2 );
      function my_affiliates_referral( $referral_id, $data ) {
          $referral = new Affiliates_Referral();
          if ( $referral->read( $referral_id ) ) {
              //  $referral->reference contains the order ID
              if ( $referral->referral_items !== null ) {
                  foreach ( $referral->referral_items as $item ) {
                      // $item->reference contains the order item ID
                      if ( $item->type === 'product' ) {
                          $product_id = $item->object_id;
                          $adjustments = 0;
                          // @todo $adjustments = ....; amount -= $adjustments;
                      }
                  }
                  $referral->compute(); // calculates the referral total
                  $referral->update(); // saves the changes
              }
          }
      }

      I hope that this is helpful, please excuse the delay in my reply as I had taken your question into account while we are working on the upcoming release. If you would like to take the above approach, it can be an immediate solution as long as you implement the parts that are needed to obtain the adjustments. If you would rather like to wait for the next release, please let me know so we can pick the conversation up taking the additional features into account.

      Cheers

  2. Remmy Castillio January 7, 2019 at 2:11 am #

    Specifically, we need to run to run a calc that looks like this:
    Net sale of Woocommerce virtual product (membership) sales price: $1499 – $250 fixed cost = $1240 net * .3 = 374.70 commission – we need to do this as a formula rather then a fixed $374 commission as a coupon may be applied to the full $1499 price, but still need fixed cost deducted before 30% commission is applied to net after coupon.

    We have a plugin for APIs on the system, so if there is a spot where we can intercept with a hook, action, filter, etc. then we can probably code for that in the existing plugin. A link to a helpful article on this would be fine.

    Thank you for your kind help!

    • Kento January 9, 2019 at 1:10 pm #

      Hi,

      Thank you very much explaining this – I’m not quite sure yet if you would actually need a specific formula implemented.

      The commissions are calculated based on the net order amount, which means that if a coupon is applied and you use a rate (not a fixed commission), then the resulting commission amount will be proportional to the net order amount.

      Based on the calculation you mention, would it be sufficient to create a 0.3 rate that would calculate the commission as a percentage of the net order amount? Or, in addition to the proportional commission, would you also need to deduct a fixed amount?

      We are preparing some interesting improvements to the rates and the affiliate dashboard, it could just fit in with those, so I’d like to make sure that we take your requirements into account.

      Cheers

  3. Kento January 4, 2019 at 5:57 pm #

    Hi Remmy,

    In most cases our flexible Rates system is covering everything you would need. So I would first recommend to have a look at this documentation section: Rates related to Affiliates Enterprise and the rates system.

    Once you have reviewed this, please let me know if you have further questions or need help with a particular case.

    Cheers

We use cookies to optimize your experience on our site and assume you're OK with that if you stay.
OK, hide this message.

Affiliates · Contact · Jobs · Terms & Conditions · Privacy Policy · Documentation · Downloads · Useful Plugins · My Account

Share