GREAT call. I was researching all the other topics on this, since author has not fixed it.
And this is the answer. I added JS to my wordpress system, to resolve this issue:
$(document).ready(function() {
if (!jQuery('input[type=checkbox][name*="shippingSameBilling"]').prop('checked')) jQuery('input[type=checkbox][name*="shippingSameBilling"]').trigger('click');
});
I had not thought of that, until you que’d it. Thanks!!
So basically it forces it to be checked by default. I would rather force people to click a checkbox and retype values, than suffer this impassable error.
Here’s my complete fix for this issue.
<script type="text/javascript">
// include this function somewhere
function WPECOM_BUGFIX(options) {
var target=jQuery('input[type=checkbox][name*="shippingSameBilling"]');
if (target.length > 0) {
if (options.force_shippingSameAsBilling) {
if (!target.prop('checked')) target.trigger('click'); // have to trigger click, as the .prop() won't hide the inputs automatically.
}
if (options.force_valueMatch) {
var form=$('form.wpsc_checkout_forms');
form.on('submit',function(event) {
if (options.force_valueMatch) {
if (target.prop('checked')) {
var billing_root=form.find('table input[data-wpsc-meta-key^="billing"]:not(.wpsc-meta-value):first').parents('table');
var shipping_root=form.find('table input[data-wpsc-meta-key^="shipping"]:not(.wpsc-meta-value):first').parents('table');
shipping_root.find('input[data-wpsc-meta-key*="i"]') // all of them have a letter i in their attribute(sh[i]pping, b[i]lling). This is simply to test for existence of the attribute, without having to run a jquery filter. Because none of these share a class or anything to identify them distinctly....
.each(function() {
var ident=$(this).data('wpscMetaKey').replace('shipping','');
var assigned_el=billing_root.find('input[data-wpsc-meta-key*="'+ident+'"]'); // find the associated billing input.
var assigned_value=assigned_el.val();
$(this).val(assigned_value); // copy it's value over.
});
}
}
});
}
}
}
</script>
and the execution on page load..
$(document).ready(function() {
// call this on page load.
// both options should be turned on, in order to fix the issue with AutoComplete filling entries without keystroke events, and to prevent php errors in WPEcom from failed submit forms.
// this is due to incorrect validation when Shipping should be same as Billing. An ongoing issue for at least 8 months.
WPECOM_BUGFIX({
force_shippingSameAsBilling: true, // enable the checkbox by default, to support the following two methods. User will have to uncheck it to enter shipping info.
force_valueMatch: true // force the values of shipping to match billing
});
});
Am unsure why the php code hasn’t been updated for this. It shouldn’t be validating form fields whose values are empty due to a conditional checkbox.
So the above code simply copies the values over, onSubmit. Preventing user difficulty. They have simply to uncheck the box if they wish to input shipping information.