• Resolved Because Name Already Exists

    (@because-name-already-exists)


    Hello,
    Currently customer can make order and checkout extra service without booking any seat, i need to avoid that.
    I already hide extra service field when seat quantity below 1.

    if (total_seat > 0)
    {
    $(“.wbtm_heading”).html(‘Extra Service‘);
    $(“.mage_input_group”).removeClass(‘hide’);
    $(“.extra-qty-box”).removeClass(‘hide’);
    } else {
    $(“.mage_input_group”).addClass(‘hide’);
    $(“.extra-qty-box”).addClass(‘hide’);
    $(“.extra-qty-box”).val(‘0’);
    $(“.wbtm_heading”).html(‘Extra Service (add seat quantity first)’);
    }

    But when page reloaded or customer view other bus / boat detail by click toggle, seat quantity mot changed, so extra service field shown.

    Is there any javascript function available to reset seat quantity to zero? I need that to adding on event when customer view another bus / boat. Maybe something like bookingSeatReset();

    I have observe bus_script.js file but still not have idea.

    Thank you

Viewing 1 replies (of 1 total)
  • Thread Starter Because Name Already Exists

    (@because-name-already-exists)

    I cant update my first post, here are the completed code that i added through wp_enqueue_script

    $('.wbtm-qty-change').click(function() {
    waitForElm('.price-figure').then((elm) => {
      totalp = 0;
      $('.price-figure').each(function(i, obj) {
        tp = $(obj).html();
        totalp = totalp+parseInt(tp);
    });
    
    if (totalp > 0)
    {
    $(".wbtm_heading").html('<strong>Extra Service</strong>');
      $(".mage_input_group").removeClass('hide');
      $(".extra-qty-box").removeClass('hide');
    } else {
      $(".mage_input_group").addClass('hide');
      $(".extra-qty-box").addClass('hide');
      $(".extra-qty-box").val('0');
      $(".wbtm_heading").html('<strong>Extra Service</strong> (add seat quantity first)');
    }
      });
    });
Viewing 1 replies (of 1 total)
  • The topic ‘Reset Seat Quantity’ is closed to new replies.