Viewing 1 replies (of 1 total)
  • Plugin Author Franky

    (@liedekef)

    See the discount examples for this.
    In your case, for example for event with id 5:

    add_action('eme_insert_rsvp_action', 'my_eme_discount_function',20,1);
    function my_eme_discount_function($booking) {
       global $wpdb;
       $bookings_table = $wpdb->prefix.BOOKINGS_TBNAME;
       $where = array();
       $fields = array();
    
       $booking_id = $booking['booking_id'];
       $event_id = $booking['event_id'];
    
       if ($event_id == 5) {        /* put in the event_id that needs processing, or leave out this line to process all events */
          $seats=$booking['booking_seats'];
          $price=$booking['booking_price'];
    
          // check the booking date
          if ($booking['creation_date datetime']) < "....") {
             $price = xxxx;
          }
    
          $fields['booking_price'] = $price;
          $where['booking_id'] = $booking['booking_id'];
          $wpdb->update($bookings_table, $fields, $where);
       }
       return;
    }

    Change

    if ($booking['creation_date datetime']) < "....") {
             $price = xxxx;
          }

    to your liking (and the event-id too). Or get all event details with:
    eme_get_event($event_id);
    and compare the booking creation date/time with $event[‘event_start_date’] and $event[‘event_start_time’]

Viewing 1 replies (of 1 total)
  • The topic ‘How to do Early Bird pricing’ is closed to new replies.