Last active
December 26, 2015 14:09
-
-
Save sidharrell/7163075 to your computer and use it in GitHub Desktop.
apply coupon code to primary attendee only
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function apply_coupon_to_primary_attendee_only ($ext_att_data_source) { | |
global $wpdb; | |
$attendee = $wpdb->get_row('SELECT * FROM ' . EVENTS_ATTENDEE_TABLE . ' WHERE id=' . $ext_att_data_source['attendee_id'], ARRAY_A); | |
if ($attendee['is_primary'] != 1) { | |
$wpdb->update(EVENTS_ATTENDEE_TABLE, | |
array('final_price'=>$attendee['orig_price']), | |
array('id'=>$attendee['id']), | |
array('%f'), | |
array('%d')); | |
} | |
} | |
add_action('action_hook_espresso_save_attendee_data', 'apply_coupon_to_primary_attendee_only'); | |
// bug in 3.1.36.1.P. need to change line 572 of includes/process-registration/add_attendees_to_db.php from | |
// $ext_att_data_source['attendee_id'] = $attendee_id; | |
// to: | |
$ext_att_data_source['attendee_id'] = $ext_attendee_id; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment