Advertisement
Guest User

Affiliates by @itthinx - no referral with coupons

a guest
Jan 10th, 2014
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.49 KB | None | 0 0
  1. add_filter('affiliates_record_referral', 'eggemplo_affiliates_record_referral', 10, 2);
  2.  
  3. function eggemplo_affiliates_record_referral ($algo, $data) {
  4.  
  5.     if ( class_exists( 'WC_Order' ) ) {
  6.         $order = new WC_Order();
  7.     } else {
  8.         $order = new woocommerce_order();
  9.     }
  10.     if ( $order->get_order( $data['post_id'] ) ) {
  11.         if( $order->get_used_coupons() ) {
  12.             $coupons_count = count( $order->get_used_coupons() );
  13.             if ( $coupons_count>0 ) {
  14.                 return false;
  15.             }
  16.         }
  17.     }
  18.     return $data;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement