Add a triggerHandler called "checkout_place_order_success" so plugin developers can hook into AJAX order success event.

This commit is contained in:
Rafi Yagudin 2019-12-22 16:35:51 -07:00
parent 0e2ed1f408
commit e03861640e
1 changed files with 2 additions and 2 deletions

View File

@ -381,7 +381,7 @@ jQuery( function( $ ) {
}
}
});
// Always update the fragments
if ( data && data.fragments ) {
$.each( data.fragments, function ( key, value ) {
@ -538,7 +538,7 @@ jQuery( function( $ ) {
wc_checkout_form.detachUnloadEventsOnSubmit();
try {
if ( 'success' === result.result ) {
if ( 'success' === result.result && $form.triggerHandler( 'checkout_place_order_success' ) !== false ) {
if ( -1 === result.redirect.indexOf( 'https://' ) || -1 === result.redirect.indexOf( 'http://' ) ) {
window.location = result.redirect;
} else {