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.

  • 1
    You probably need to have your JavaScript actually submit the form rather than reload the page. – Jeremy Gimbel Feb 5 '14 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 Feb 5 '14 at 17:38
2

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

$("#shipping_method").change(function(e) {
    $(this.form).submit();
});
| improve this answer | |
  • 1
    Just edited to make the jquery a little easier to read :) – Adrian Macneil Feb 6 '14 at 20:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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