Jump to content

Asking for confirmation after selecting a carrier


Innla

Recommended Posts

Hi!

I am trying to request confirmation when a specific carrier is selected in my store. I have managed to show a modal when this carrier is selected and the user click the 'continue' button, but i am not able to reach the next step after the user click the accept button in this modal.

Before showing the modal I do 'e.preventDefault' in my jQuery code and after confirmation i try to submit the form but this reload the carrier step instead of showing the payment method.

Any ideas of how to do this?

This my code:

HTML

<div class="modal" id="confirm" tabindex="-1" role="dialog">
  ...
  <div class="modal-footer">
    <button type="button" class="btn btn-primary" data-dismiss="modal" id="accept">Aceptar</button>
    <button type="button" class="btn btn-secondary" data-dismiss="modal" id="close">Close</button>
  </div>
  ...
</div>

JS:

$('button[name="confirmDeliveryOption"]').on('click', function(e){
  if($('#delivery_option_527').is(":checked")) {
  	e.preventDefault();
  	$('#confirm').modal(); 
  }     
});

$('#accept').on('click', function(e){
	$('#js-delivery').submit();
});

Thanks in advance!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...