Not assign if order total value is $0

Is there a way to configure or code not to assign if the customer’s order has total value $0? In other words, we would not assign affiliate permanently if the customer only orders free products.


Comments

One response to “Not assign if order total value is $0”

  1. Hi Huaqing,

    In order to check each referred order you need to hook into the added referral and find the order total. This can be done using the affiliates_referral action hook where you can find the order total inside the $params['data'] array. Apart from that you can also find the order id which will be useful later on. Afterwards you can delete the permanent affiliate if you find the customer placing the order and then delete_user_meta with meta_key ‘permanent_referrer_affiliate_id’.
    FYI, and in order to successfully remove the permanent assignment, make sure to hook with a low priority like the following:
    add_action( 'affiliates_referral', 'your_callback_function', 12, 2 );
    Hope it helps.

    Kind regards,
    George

Share