Fix PayPal button display on blocks conditions

This commit is contained in:
Pedro Silva 2024-01-16 16:05:03 +00:00
parent 1fe9b9f1a6
commit 408503af1a
No known key found for this signature in database
GPG key ID: E2EE20C0669D24B3
2 changed files with 6 additions and 2 deletions

View file

@ -466,9 +466,10 @@ const features = ['products'];
let block_enabled = true; let block_enabled = true;
if(cartHasSubscriptionProducts(config.scriptData)) { if(cartHasSubscriptionProducts(config.scriptData)) {
// Don't show buttons on block cart page if using vault v2 // Don't show buttons on block cart page if using vault v2 and user is not logged in
if ( if (
config.scriptData.context === "cart-block" ! config.scriptData.user.is_logged
&& config.scriptData.context === "cart-block"
&& ! isPayPalSubscription(config.scriptData) // using vaulting && ! isPayPalSubscription(config.scriptData) // using vaulting
&& ! config.scriptData?.save_payment_methods?.id_token // not vault v3 && ! config.scriptData?.save_payment_methods?.id_token // not vault v3
) { ) {

View file

@ -1170,6 +1170,9 @@ document.querySelector("#payment").before(document.querySelector("#ppcp-messages
'basic_checkout_validation_enabled' => $this->basic_checkout_validation_enabled, 'basic_checkout_validation_enabled' => $this->basic_checkout_validation_enabled,
'early_checkout_validation_enabled' => $this->early_validation_enabled, 'early_checkout_validation_enabled' => $this->early_validation_enabled,
'funding_sources_without_redirect' => $this->funding_sources_without_redirect, 'funding_sources_without_redirect' => $this->funding_sources_without_redirect,
'user' => array(
'is_logged' => is_user_logged_in(),
),
); );
if ( 'pay-now' === $this->context() ) { if ( 'pay-now' === $this->context() ) {