Is there a way to set a default starting quantity for the tickets? Right now it all starts at zero, but I would like it to start at 1 just for convenience sake of user having to just click book once they get into page.

Ronald Friedman
Hi Ronald,
What’s the particular context? It sounds like you selling only ticket for a non-recurring event (or by series)? If you’re ok to also then limit them to one ticket, you can enable ‘Simple Booking Mode’ (see settings tab of the form customiser).
If you don’t, then you can copy the template eo-ticket-picker.php
(from event-organiser-pro/templates
) into your theme and edit it there. Specifically, change the line (~71) from
<?php $value = ( isset( $input['tickets'][$ticket_id] ) ? $input['tickets'][$ticket_id] : 0 ); ?>
to
<?php $value = ( isset( $input['tickets'][$ticket_id] ) ? $input['tickets'][$ticket_id] : 1 ); ?>

Stephen Harris
The second portion worked perfectly and that is what I was looking to do (the template changes on line 71, to modify default from 0 to 1). Thank you!
-
This reply was modified 11 years, 4 months ago by
Ronald Friedman.

Ronald Friedman
I moved my template from the plugin’s templates folder into my theme’s directory, and made the change but am not seeing the default quantity change. What do you think is wrong?

handhugs
I am having the same problem as handhugs with this not updating too.
I can see the default value is set in the code (see screen grab here: https://www.dropbox.com/s/wwyhkz64ltdqwej/Screen%20Shot%202015-07-31%20at%2017.37.50.png?dl=0) but it still displays as 0. I’ve emptied caches and no change.
I assume this is being overwritten by JS using the data-eo-ticket-qty attribute but I can see how to control that.
Any ideas?
-
This reply was modified 9 years, 7 months ago by
David McCourt.

David McCourt
Hi David,
The above advice is outdated – and you’re right – this is over-ridden by the javascript. There’s no API exposed for modifying the ticket quantity, however, you can do the following:
add_action( 'eventorganiser_get_event_booking_form', function( $form_id, $event_id ){
$tickets = eo_get_event_tickets_on_sale( $event_id );
if( isset( $_POST['eventorganiser']['booking']['tickets'] ) ) {
return;
}
$_POST['eventorganiser']['booking']['tickets'] = array();
foreach ( $tickets as $tt_id => $ticket ) {
//Set default quantity below
$_POST['eventorganiser']['booking']['tickets'][$tt_id] = 1;
}
}, 10, 2 );
Simply add that to a utilty plug-in or theme’s functions.php

Stephen Harris