Okay
  Public Ticket #3135072
Ticket Sales, Default Quantity to ZERO
Closed

Comments

  •  4
    Tymnus started the conversation

    Regarding Ticket Sales: Is there a way to make the default ticket quantity to “1” in the sales popup? Currently, the default is set to ZERO. Please help.

  •  894
    Zhivko replied

    Hi,

    Place this hook in your theme or child-theme functions.php file.

    /**
     * Set booking quantity to 1 by default
     */
    add_action('wp_footer', function () {
        ?>
        <script type="text/javascript">
            (function($) {
                $(function() {
                    if (typeof window.StecBooking === 'undefined') {
                        return;
                    }
                    window.StecBooking.prototype.popOpen = function() {
                        var popup,
                            scroller;
                        $('body').addClass('stec-modal-opened stec-no-scroll');
                        $('#stec-layout-event-inner-out-wrapper-' + this.settings.glob.options.id).hide();
                        popup = $(this.popHtml()).appendTo('body');
                        if (!popup.find('.stec-scrollable').data('stec-scroll')) {
                            scroller = new window.StecScroll();
                            scroller.create(popup.find('.stec-scrollable'));
                            $(this).find('.stec-scrollable').data('stec-scroll', scroller);
                        }
                        $('.stec-booking-item-quantity').val(1);
                    }
                });
            })(window.jQuery);
        </script>
    <?php
    });

    Stachethemes Developer