Fix ApplePay token update

This commit is contained in:
Pedro Silva 2024-01-31 14:59:47 +00:00
parent 8d82e51506
commit 0cf3f946c6
No known key found for this signature in database
GPG key ID: E2EE20C0669D24B3
2 changed files with 7 additions and 2 deletions

View file

@ -105,8 +105,13 @@ class VaultingModule implements ModuleInterface {
return $tokens;
}
$is_post = isset( $_SERVER['REQUEST_METHOD'] ) && $_SERVER['REQUEST_METHOD'] === 'POST';
// Exclude ApplePay tokens from payment pages.
if ( is_checkout() || is_cart() || is_product() ) {
if (
( is_checkout() || is_cart() || is_product() )
&& ! $is_post // Don't check on POST so we have all payment methods on form submissions.
) {
foreach ( $tokens as $index => $token ) {
if ( $token instanceof PaymentTokenApplePay ) {
unset( $tokens[ $index ] );