auto-patch 638-dev-dev01-2024-05-14T20_44_36

This commit is contained in:
root
2024-05-14 20:44:36 +00:00
parent a941559057
commit 5dbb0b284e
1812 changed files with 29671 additions and 14588 deletions

View File

@@ -501,13 +501,13 @@ jQuery( function( $ ) {
var maybe_valid_json = raw_response.match( /{"result.*}/ );
if ( null === maybe_valid_json ) {
console.log( 'Unable to fix malformed JSON' );
console.log( 'Unable to fix malformed JSON #1' );
} else if ( wc_checkout_form.is_valid_json( maybe_valid_json[0] ) ) {
console.log( 'Fixed malformed JSON. Original:' );
console.log( raw_response );
raw_response = maybe_valid_json[0];
} else {
console.log( 'Unable to fix malformed JSON' );
console.log( 'Unable to fix malformed JSON #2' );
}
}
@@ -560,10 +560,21 @@ jQuery( function( $ ) {
// Detach the unload handler that prevents a reload / redirect
wc_checkout_form.detachUnloadEventsOnSubmit();
// This is just a technical error fallback. i18_checkout_error is expected to be always defined and localized.
var errorMessage = errorThrown;
if (
typeof wc_checkout_params === 'object' &&
wc_checkout_params !== null &&
wc_checkout_params.hasOwnProperty( 'i18n_checkout_error' ) &&
typeof wc_checkout_params.i18n_checkout_error === 'string' &&
wc_checkout_params.i18n_checkout_error.trim() !== ''
) {
errorMessage = wc_checkout_params.i18n_checkout_error;
}
wc_checkout_form.submit_error(
'<div class="woocommerce-error">' +
( errorThrown || wc_checkout_params.i18n_checkout_error ) +
'</div>'
'<div class="woocommerce-error">' + errorMessage + '</div>'
);
}
});
@@ -617,8 +628,9 @@ jQuery( function( $ ) {
});
var data = {
security: wc_checkout_params.apply_coupon_nonce,
coupon_code: $form.find( 'input[name="coupon_code"]' ).val()
security: wc_checkout_params.apply_coupon_nonce,
coupon_code: $form.find('input[name="coupon_code"]').val(),
billing_email: wc_checkout_form.$checkout_form.find('input[name="billing_email"]').val()
};
$.ajax({