Okay
  Public Ticket #1892442
Preselect Default Values
Closed

Comments

  • Putri Nadia started the conversation

    Hi, so far the plugin has been working great. However, I've noticed the process of booking an event is rather tedious because the customer has picked an event  (course) they want but when they want to book, the have to choose the date again, ticket, discount code (if available) and ticket quantity. 

    Will it be possible if let's say that the customer has picked a Game Wizard Course Event on the calendar, the value is already selected in the dropdown option. They just need to enter the ticket quantity and discount code.

    The current situation is like the current_situation.png and how I want it to behave by default is the how_i_want.png. 

    Thank you.

  •  894
    Zhivko replied

    Hi,

    Add to your theme functions.php file at the bottom following code:

    add_action('wp_footer', function() {
        ?>
        <script type="text/javascript">
            (function ($) {
                $('.stec').on('onEventToggleOpen', function () {
                    var $th = $(this).find('.stec-layout-event.active');
                    setTimeout(function () {
                        $th.find('select[name="stec_book_date"]').prop("selectedIndex", 1);
                        $th.find('select[name="stec_book_item"]').prop("selectedIndex", 1);
                        $th.find('input[name="stec_book_quantity"]').val(1); // optional set quantity to 1
                    });
                });
            })(jQuery);
        </script>
        <?php
    });



    Stachethemes Developer

  • Putri Nadia replied

    Thank you! It's working great! So far all my issues that I've raised here were resolved quickly :)