[Event Ticket Plus] Javascript to change form qty

Hi,
I´d like to default to 1 the Event Ticket Plus form qty shown in the following screen capture http://prntscr.com/mwx4p9
I contacted the plugin creator and they told me that I could either create a custom template for the ticket form and change the "min" value on the field from 0 to 1. - OR - Add some custom javascript to change this when the page loads.
Sample Event: https://grumav.com/evento/intensivo-de-insercion-ecoguiada-de-cateter-picc-y-midline/

Also, I´d like to have an up/down arrow like the one shown in their demo page http://prntscr.com/mwx7fy
Demo: https://wpshindig.com/event/event-tickets-plus-demo/

Can you please help me choosing the best option and to achieve my goal?
Regards,
Pablo

  • Dimitris
    • Support Star

    Hello there Pablo,

    hope you're doing well today! :slight_smile:

    Could you please install and activate the following plugin:
    https://wordpress.org/plugins/custom-css-js/

    and then try to create a new JS custom snippet and add in there the exact code:

    (function($) {
      $(document).ready(function(){
        $('.input-text.qty').val('1');
      });
    })( jQuery );

    As for the arrows inside the theme, you will also need the support of the theme you're using, as the CSS needed is:

    .single-tribe_events input.input-text.qty[type=number] {
        -webkit-appearance: inner-spin-button;
        -moz-appearance: outer-spin-button;
        -ms-appearance: outer-spin-button;
        appearance: outer-spin-button;
    }

    but as there're also others CSS rules, there's a need for some fine-tuning (main issue is that the counters are showing on the left of the value).

    Hope that was some help!
    Warm regards,
    Dimitris

  • Pablo
    • Flash Drive

    Hi Dimitris,
    I´ve done what you suggested and it worked fine as long as I had one type of ticket.
    Now I created a new event with two types of tickets and the code you sent me changes both qty fields from 0 to 1.
    Please see:
    https://grumav.com/evento/curso-presencial-teorico-practico-de-acceso-venoso-en-el-paciente-neonato-y-pediatrico/
    The problem with this is that when a customer presses on "Add to cart" 2 tickets are added to cart, one of each type.
    Is there any way to increase the qty of the cheapest ticket only, or increase the qty when there´s only one type of ticket?
    Regards,
    Pablo

  • Dimitris
    • Support Star

    Hello there Pablo,

    hope you're doing well today! :slight_smile:

    I guess that the cheapest ticket goes first in the form, is that correct?
    If so, you could easily surpass that by replacing previous JS snippet with the following, which will change the input value of the first ticket only:

    (function($) {
      $(document).ready(function(){
        $('.tribe-tickets-form-row:first-child .input-text.qty').val('1');
      });
    })( jQuery );

    Let us know how that goes!
    Thank you,
    Dimitris

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.