Skip to content

Commit 2a0462f

Browse files
committed
Show Place Order button for saved PayPal token on non-US classic checkout
1 parent 23e2da7 commit 2a0462f

1 file changed

Lines changed: 12 additions & 12 deletions

File tree

modules/ppcp-button/resources/js/modules/ContextBootstrap/CheckoutBootstrap.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -253,19 +253,18 @@ class CheckoutBootstrap {
253253
setVisibleByClass(
254254
this.standardOrderButtonSelector,
255255
( isPaypal && isFreeTrial && hasVaultedPaypal ) ||
256-
// On a zero-total cart the Vault Component is disabled, so selecting a
257-
// saved PayPal token must show the standard "Place order" button. The
258-
// saved token completes via process_payment's free-trial short-circuit.
259-
( isPaypal &&
260-
isFreeTrial &&
261-
this.isSavedPayPalTokenSelected() ) ||
262256
isNotOurGateway ||
263257
isSavedCard ||
264258
( isPaypal && ! useSmartButtons ) ||
265-
( showVaultComponent && ! this.isNewPaymentMethodSelected() ),
259+
// Selecting a saved PayPal token always uses the standard "Place order"
260+
// button, regardless of merchant country. For US merchants the Vault
261+
// Component additionally renders its in-page approval; for everyone else
262+
// process_payment charges the saved token server-side (reference
263+
// transaction, or the free-trial short-circuit on a zero-total cart).
264+
( isPaypal && this.isSavedPayPalTokenSelected() ),
266265
'ppcp-hidden'
267266
);
268-
this.updatePlaceOrderButtonText( showVaultComponent );
267+
this.updatePlaceOrderButtonText();
269268
setVisible( '.ppcp-vaulted-paypal-details', isPaypal );
270269
setVisible(
271270
this.gateway.button.wrapper,
@@ -411,15 +410,16 @@ class CheckoutBootstrap {
411410
);
412411
}
413412

414-
updatePlaceOrderButtonText( showVaultComponent ) {
413+
updatePlaceOrderButtonText() {
415414
const $placeOrder = jQuery( this.standardOrderButtonSelector );
416415
if ( ! $placeOrder.length ) {
417416
return;
418417
}
419418

420-
if ( showVaultComponent && ! this.isNewPaymentMethodSelected() ) {
421-
// The saved-token vault flow approves the order in-page, so the
422-
// standard "Place order" label fits — clicking does not redirect.
419+
if ( this.isSavedPayPalTokenSelected() ) {
420+
// A saved PayPal token completes in-page (Vault Component approval) or
421+
// server-side (reference transaction), never via redirect, so the
422+
// standard "Place order" label fits in every case.
423423
$placeOrder.text( $placeOrder.data( 'value' ) );
424424
return;
425425
}

0 commit comments

Comments
 (0)