Support

Home Forums Multiple Event Registration Add-on Auto-populate 1 attendee in registration

Auto-populate 1 attendee in registration

Posted: February 13, 2015 at 4:07 am


David Traxler

February 13, 2015 at 4:07 am

I am looking to auto-populate the dropdown field for number of attendees with a “1”. This is to streamline the registration process.

When a user adds an event to their cart and then views that cart the default number of attendees is set to “0”, how can I change this default to “1”.

Thanks!


Josh

  • Support Staff

February 13, 2015 at 5:13 pm

Hi David,

This will involve adding some code just after the closing </form> tag in Event Espresso 3’s shopping_cart.php template. Example code follows:

<script>jQuery(document).ready(function(){
    jQuery(".price_id").val(1).hide();
    jQuery('#event_espresso_refresh_total').trigger('click');
});
</script>

// change it to 1

<script>jQuery(document).ready(function(){
    jQuery('.price_id').first().find('option').remove().end().append('<option selected="selected" value="1">1</option>').val(1);
    jQuery('.price_id').last().find('option:last').remove();
    jQuery('#event_espresso_refresh_total').trigger('click');
});
</script>

As always, if you make a change in a template that’s within the plugin’s folder, the change will be lost when you update. You can avoid this by copying the modified template over to /wp-content/uploads/espresso/templates. There is more information about customizing templates in Event Espresso 3 here:

https://eventespresso.com/wiki/put-custom-templates/


David Traxler

February 14, 2015 at 1:39 pm

Does the trick! Thanks.

The support post ‘Auto-populate 1 attendee in registration’ 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