Support

Home Forums Event Espresso Premium Split: Set number of tickets by default on 1

Split: Set number of tickets by default on 1

Posted: March 17, 2018 at 5:14 pm

Viewing 7 reply threads


pelostieso

March 17, 2018 at 5:14 pm

I have the same problem…

http://www.micrisordos.org/wdag2020/events/wdag-2020-registration-only/

I would like to have “1” by default as QTY for each ticket, but giving the possibility to change them to “0”. When want every register come to our Conference for all the days (QTY = “1” for all days), but if He don’t want to come 1 day for example, would be able to change this value to “0”.

Thanks.


Josh

  • Support Staff

March 19, 2018 at 12:55 pm

Hi there,

You can change the quantity to 1 by adding a bit of jQuery to the page:

add_action(
    'wp_enqueue_scripts', 
    'my_add_inline_script_ts_set_default_qty', 
    20
);
function my_add_inline_script_ts_set_default_qty() {
    $custom_js = 'jQuery(document).ready(function($){
        $(".ticket-selector-tbl-qty-slct").val(1)
    });';
    wp_add_inline_script('ticket_selector', $custom_js);
}

You can add the above to a functions plugin or into your WordPress theme’s functions.php file.


mamlearning

March 19, 2018 at 1:12 pm

Brilliant, thanks Josh, works like a charm!


pelostieso

March 20, 2018 at 9:34 am

Great job Josh! Works perfect. Thanks a lot. 😉


mamlearning

March 21, 2018 at 4:17 am

@Josh! I found a little problem with the jQuery solution you offered.
If for some tickets I set the limit per person to 1 and offer 2 variants of the ticket, then it gives a problem. because apparently both tickets then have the number set to 1 and EE gets confused and gives an error message.


Tony

  • Support Staff

March 21, 2018 at 5:27 am

Well, yes, it will because your defaulting all tickets to have a default Qty of 1 so the user would need to set one of the tickets to 0 (which is one of the reasons we do not default to 1 on the ticket selector).

So to confirm, you have the ‘Maximum number of tickets allowed per order for this event’ option set to 1, but have multiple ticket options on the event which are all now defaulting to 1 (meaning the total number of selected tickets is greater than 1)?


mamlearning

March 24, 2018 at 4:39 am

That is exactly the situation Tony, which results in both tickets having a radio button instead of a number, and both tickets are set to 1.


Tony

  • Support Staff

March 24, 2018 at 5:55 am

Try this slight change to Josh’s example:

add_action(
    'wp_enqueue_scripts', 
    'my_add_inline_script_ts_set_default_qty', 
    20
);
function my_add_inline_script_ts_set_default_qty() {
    $custom_js = 'jQuery(document).ready(function($){
        $("select.ticket-selector-tbl-qty-slct").val(1)
    });';
    wp_add_inline_script('ticket_selector', $custom_js);
}
Viewing 7 reply threads

The support post ‘Split: Set number of tickets by default on 1’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso