• Resolved wilcox

    (@wilcox)


    Most events we post have the same 3 levels of ticket price. Can I make these 3 ticket levels the defaults, so that when I configure a new event, the Bookings section defaults to those 3 ticket levels/prices?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hello,
    There’s no option to do that within admin, but we do have this snippet:
    http://pastebin.com/vqEMvQeT

    Pasting that code in the functions.php file of your theme, will override the standard defaults. You’d need to customize the code a little to set the defaults you want. Let us know if you need more help with that.

    Yes, you can 🙂

    Change the default ticket:

    <?php
    /*
    for more information on adding this snippet to your site, see here 
    http://wp-events-plugin.com/tutorials/how-to-safely-add-php-code-to-wordpress/
    */
    
    /**
     * Changes the initial values/settings of a default ticket.
     * @param EM_Ticket $EM_Ticket
     */
    function my_em_modify_default_ticket($EM_Ticket) {
    	if ( empty($EM_Ticket->ticket_id) ) {
    	    //you can modify any property in $EM_Ticket such as spaces or the ticket name, add or delete lines as necessary
    	    $EM_Ticket->ticket_spaces = 999; //ticket spaces
    	    $EM_Ticket->ticket_name = 'Custom Ticket Name';  //ticket name
    	    $EM_Ticket->ticket_description = 'Custom Ticket Description';  //ticket description
    	    $EM_Ticket->ticket_price = 100; //ticket price
    	    //etc.
    	}
    }
    add_filter('em_ticket', 'my_em_modify_default_ticket', 10, 2);

    Or change the default ticket type:

    function my_em_add_default_tickets($tickets, $EM_Bookings, $force_reload = false) {
        if ( empty($tickets->tickets) ) {
            $ticket_data = array();
            $ticket_data[0] = array('ticket_name' => 'Basic', 'ticket_description' => 'Basic Member', 'ticket_spaces' => 10, 'ticket_price' => 450 );
            $ticket_data[1] = array('ticket_name' => 'Accelerated', 'ticket_description' => 'Accelerated Member', 'ticket_spaces' => 10, 'ticket_price' => 375);
            $ticket_data[2] = array('ticket_name' => 'Premium', 'ticket_description' => 'Premium Member', 'ticket_spaces' => 10, 'ticket_price' => 350);
            $ticket_data[3] = array('ticket_name' => 'Free', 'ticket_description' => 'No Charge', 'ticket_spaces' => 10, 'ticket_price' => 0);
            if (is_array($tickets->tickets)) unset($tickets->tickets);
            foreach ($ticket_data as $ticket) {
                $EM_Ticket = new EM_Ticket($ticket);
                $tickets->tickets[] = $EM_Ticket;
            }
        }
        return $tickets;
    }
    add_filter('em_bookings_get_tickets', 'my_em_add_default_tickets', 10, 2);
    Thread Starter wilcox

    (@wilcox)

    Thanks you both for solutions – I will confirm your code(s) and reply.

    Thread Starter wilcox

    (@wilcox)

    @duisterdenhaag
    many thanks – the ‘default_ticket_type’ code worked perfectly – just the results I wanted.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Default Ticket prices’ is closed to new replies.