Here's what worked for me on version 2.3.x
In my theme, on checkout.tpl, I added 'style="display: none;"' to the panel section for shipping method. Like this:
Code: Select all
<div class="panel panel-default" style="display: none;">
<div class="panel-heading">
<h4 class="panel-title"><?php echo $text_checkout_shipping_method; ?></h4>
</div>
<div class="panel-collapse" id="collapse-shipping-method">
<div class="panel-body"></div>
</div>
</div>
THEN, in the jQuery section at the end of the document, find the section that deals with the shipping address button click. Find the part of that code that handles the successful loading of the shipping_method template. It starts with this:
Code: Select all
$.ajax({
url: 'index.php?route=checkout/shipping_method',
dataType: 'html',
complete: function() {
$('#button-shipping-address').button('reset');
},
success: function(html) {
Within that success block, there are five commands that essentially open up the shipping method panel. After those five things, insert this line of code:
Code: Select all
$('#button-shipping-method').trigger('click');
That clicks the shipping method button and then all the code proceeds as planned. By the way, I have all shipping methods disabled except free shipping. Since that's the only method available, it's checked by default. Thus the shipping method gets saved and the checkout process can continue. You can use the language files and other templates to hide the "Free Shipping" on confirmation pages.
For clarity, here is the entire block of code that handles the shipping address button click, with my one line inserted in it on line 52.
Code: Select all
// Shipping Address
$(document).delegate('#button-shipping-address', 'click', function() {
$.ajax({
url: 'index.php?route=checkout/shipping_address/save',
type: 'post',
data: $('#collapse-shipping-address input[type=\'text\'], #collapse-shipping-address input[type=\'date\'], #collapse-shipping-address input[type=\'datetime-local\'], #collapse-shipping-address input[type=\'time\'], #collapse-shipping-address input[type=\'password\'], #collapse-shipping-address input[type=\'checkbox\']:checked, #collapse-shipping-address input[type=\'radio\']:checked, #collapse-shipping-address textarea, #collapse-shipping-address select'),
dataType: 'json',
beforeSend: function() {
$('#button-shipping-address').button('loading');
},
success: function(json) {
$('.alert, .text-danger').remove();
if (json['redirect']) {
location = json['redirect'];
} else if (json['error']) {
$('#button-shipping-address').button('reset');
if (json['error']['warning']) {
$('#collapse-shipping-address .panel-body').prepend('<div class="alert alert-warning">' + json['error']['warning'] + '<button type="button" class="close" data-dismiss="alert">×</button></div>');
}
for (i in json['error']) {
var element = $('#input-shipping-' + i.replace('_', '-'));
if ($(element).parent().hasClass('input-group')) {
$(element).parent().after('<div class="text-danger">' + json['error'][i] + '</div>');
} else {
$(element).after('<div class="text-danger">' + json['error'][i] + '</div>');
}
}
// Highlight any found errors
$('.text-danger').parent().parent().addClass('has-error');
} else {
$.ajax({
url: 'index.php?route=checkout/shipping_method',
dataType: 'html',
complete: function() {
$('#button-shipping-address').button('reset');
},
success: function(html) {
$('#collapse-shipping-method .panel-body').html(html);
$('#collapse-shipping-method').parent().find('.panel-heading .panel-title').html('<a href="#collapse-shipping-method" data-toggle="collapse" data-parent="#accordion" class="accordion-toggle"><?php echo $text_checkout_shipping_method; ?> <i class="fa fa-caret-down"></i></a>');
$('a[href=\'#collapse-shipping-method\']').trigger('click');
$('#collapse-payment-method').parent().find('.panel-heading .panel-title').html('<?php echo $text_checkout_payment_method; ?>');
$('#collapse-checkout-confirm').parent().find('.panel-heading .panel-title').html('<?php echo $text_checkout_confirm; ?>');
$('#button-shipping-method').trigger('click');
$.ajax({
url: 'index.php?route=checkout/shipping_address',
dataType: 'html',
success: function(html) {
$('#collapse-shipping-address .panel-body').html(html);
},
error: function(xhr, ajaxOptions, thrownError) {
alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
}
});
},
error: function(xhr, ajaxOptions, thrownError) {
alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
}
});
$.ajax({
url: 'index.php?route=checkout/payment_address',
dataType: 'html',
success: function(html) {
$('#collapse-payment-address .panel-body').html(html);
},
error: function(xhr, ajaxOptions, thrownError) {
alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
}
});
}
},
error: function(xhr, ajaxOptions, thrownError) {
alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
}
});
});