post_id; } else { // post id of the event $event_id = $em_event->post_id; } if ( empty( $em_booking ) ) { $booking = em_get_booking( $post_id ); $booking_price_post_tax = $booking->price; } else { $booking_price_post_tax = $em_booking->price; } if ( isset( $em_booking->taxes ) ) { $booking_price = bcsub( $booking_price_post_tax, $em_booking->taxes, affiliates_get_referral_amount_decimals() ); } else { $booking_price = $booking_price_post_tax; } } if ( get_post_meta( $event_id, Affiliates_EM_Booking::REFERRAL_RATE, true ) != '' ) { $referral_rate = get_post_meta( $event_id, Affiliates_EM_Booking::REFERRAL_RATE, true ); } else { $referral_rate = $options['referral-rate']; } $amount = bcmul( $booking_price, $referral_rate, affiliates_get_referral_amount_decimals() ); return $amount; } } add_action( 'init', array( 'Affiliates_EM_Method', 'init' ) );