Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the pue-sales domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/staging-poc/public_html/wp-includes/functions.php on line 6114
Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the better-click-to-tweet domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/staging-poc/public_html/wp-includes/functions.php on line 6114
Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the pue-amazon domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/staging-poc/public_html/wp-includes/functions.php on line 6114
Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the pue-stats domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/staging-poc/public_html/wp-includes/functions.php on line 6114
Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the wordpress-seo domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/staging-poc/public_html/wp-includes/functions.php on line 6114 Force price selection (no default price) | Event Espresso - Staging Server
Is there any way to have the price selection drop-down menu not default to the first option? I have some customers who seem to be skipping over this field and end up paying the default price. I would like to force them to have to make a selection.
Well there are two options really, but both require code.
The first would be to edit a core file to add the required class to the dropdown and insert a blank selection at the top. This isnt ideal as you are changing a core file.
event-espresso/includes/functions/pricing.php, you would need to edit the espresso_price_select function.
The other option is to add some jQuery to the registration_page_display.php template to do the same. Issue with this is it wont work if javascript is turned off.
<script>
jQuery(document).ready( function() {
//get the event id
var the_event_id = <?php echo json_encode($event_id) ?>;
//add blank value to the top of the list and make it default.
jQuery("#price_option-" + the_event_id ).prepend("<option value=''></option>").val('');
//add required class to the options lists to force validation so an item has to be selected.
jQuery("#price_option-" + the_event_id ).addClass('required');
});
</script>
Dean, Thanks for getting me started in the right direction – I did have to make a couple of tweaks to the code, and ended up with the following:
jQuery(document).ready(function($) {
//get the event id
var the_event_id = document.URL;
the_event_id = the_event_id.substr(the_event_id.indexOf("?ee=")+4, the_event_id.length-the_event_id.indexOf("?ee=")-4);
//add blank value to the top of the list and make it default.
jQuery("#price_option-" + the_event_id ).prepend("").val('');
//add required class to the options lists to force validation so an item has to be selected.
jQuery("#price_option-" + the_event_id ).addClass('required');
No problem and thanks for sharing your updated code.
Viewing 3 reply threads
The support post ‘Force price selection (no default price)’ 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.