1

Can't seem to find an answer in the documentation, not sure a feature is even needed for this (might just need JS). Can't seem to figure it out though.

I'm using {field:shipping_method} to generate a select dropdown for shipping options. I'd like the total to update after a new shipping method is selected. How can I do this?

Right now I'm using:

$('#shipping_method').change(function(){
        location.reload();       
 });

To reload the page but it's not retaining the information. It resets to default shipping option.

2
  • 1
    You probably need to have your JavaScript actually submit the form rather than reload the page. Commented Feb 5, 2014 at 17:35
  • Yeah I just figured this, but the solutions I'm finding modify the <select> tag, which is being automatically generated by the Store. Would it be best to use JS to add the onchange function after the page loads?
    – 88mpg
    Commented Feb 5, 2014 at 17:38

1 Answer 1

2

Not sure if the markup is entirely correct, but this works:

$("#shipping_method").change(function(e) {
    $(this.form).submit();
});
1
  • 1
    Just edited to make the jquery a little easier to read :) Commented Feb 6, 2014 at 20:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.