Skip to content

Commit 81a919a

Browse files
committed
Hide Apple Pay saved token from classic checkout
1 parent f3d59b8 commit 81a919a

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

modules/ppcp-wc-payment-tokens/src/WcPaymentTokensModule.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,12 @@ function ( $tokens ) use ( $container ) {
9595

9696
$is_post = isset( $_SERVER['REQUEST_METHOD'] ) && $_SERVER['REQUEST_METHOD'] === 'POST';
9797

98-
// Exclude ApplePay tokens from payment pages.
99-
if (
100-
( is_checkout() || is_cart() || is_product() )
101-
&& ! $is_post // Don't check on POST so we have all payment methods on form submissions.
102-
) {
98+
// Exclude ApplePay tokens from payment pages, regardless of request method.
99+
// Apple Pay tokens are only usable for merchant-initiated subscription renewals,
100+
// never buyer-selectable at checkout. The classic checkout re-renders its payment
101+
// fields via a POST `update_order_review` AJAX call, so a `! $is_post` guard would
102+
// let the token leak back into the selectable saved-methods list.
103+
if ( is_checkout() || is_cart() || is_product() ) {
103104
foreach ( $tokens as $index => $token ) {
104105
if ( $token instanceof PaymentTokenApplePay ) {
105106
unset( $tokens[ $index ] );

0 commit comments

Comments
 (0)