-
-
Save kish2011/4f3507b04fa459e0caeb9fb1ab790be7 to your computer and use it in GitHub Desktop.
WooCommerce additional custom popup on checkout when processing payment
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'woocommerce_before_checkout_form', 'custom_payment_overlay' ); | |
function custom_payment_overlay(){ | |
echo sprintf('<div class="custom-payment-popup"><div class="wpt-payment-overlay"></div><div class="wpt-payment-message">%s</div></div>', | |
'We are processing your payment. Please hold on and do not refresh your browser.' | |
); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Display popup when form submitted | |
var checkout_form = $( 'form.checkout' ); | |
checkout_form.on( 'checkout_place_order', function() { | |
$(".custom-payment-popup").show(); | |
return true; | |
}); | |
// Hide popup if form returns an error | |
$( document.body ).on( 'checkout_error', function() { | |
$(".custom-payment-popup").hide(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment