mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 18:16:38 +08:00
Remove paypal buttons for free trial everywhere except checkout
This commit is contained in:
parent
1c0df35f53
commit
c701b46a40
2 changed files with 8 additions and 3 deletions
|
@ -122,7 +122,7 @@ document.addEventListener(
|
||||||
if (
|
if (
|
||||||
!['checkout', 'pay-now'].includes(PayPalCommerceGateway.context)
|
!['checkout', 'pay-now'].includes(PayPalCommerceGateway.context)
|
||||||
|| isChangePaymentPage()
|
|| isChangePaymentPage()
|
||||||
|| (PayPalCommerceGateway.is_free_trial_cart && vaulted_paypal_email !== '')
|
|| (PayPalCommerceGateway.is_free_trial_cart && PayPalCommerceGateway.vaulted_paypal_email !== '')
|
||||||
) {
|
) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -397,6 +397,9 @@ class SmartButton implements SmartButtonInterface {
|
||||||
if (
|
if (
|
||||||
( is_product() || wc_post_content_has_shortcode( 'product_page' ) )
|
( is_product() || wc_post_content_has_shortcode( 'product_page' ) )
|
||||||
&& ! $not_enabled_on_product_page
|
&& ! $not_enabled_on_product_page
|
||||||
|
// TODO: it seems like there is no easy way to properly handle vaulted PayPal free trial,
|
||||||
|
// so disable the buttons for now everywhere except checkout for free trial.
|
||||||
|
&& ! $this->is_free_trial_product()
|
||||||
) {
|
) {
|
||||||
add_action(
|
add_action(
|
||||||
$this->single_product_renderer_hook(),
|
$this->single_product_renderer_hook(),
|
||||||
|
@ -414,11 +417,12 @@ class SmartButton implements SmartButtonInterface {
|
||||||
! $this->settings->get( 'button_mini_cart_enabled' );
|
! $this->settings->get( 'button_mini_cart_enabled' );
|
||||||
if (
|
if (
|
||||||
! $not_enabled_on_minicart
|
! $not_enabled_on_minicart
|
||||||
|
&& ! $this->is_free_trial_cart()
|
||||||
) {
|
) {
|
||||||
add_action(
|
add_action(
|
||||||
$this->mini_cart_button_renderer_hook(),
|
$this->mini_cart_button_renderer_hook(),
|
||||||
function () {
|
function () {
|
||||||
if ( $this->is_cart_price_total_zero() ) {
|
if ( $this->is_cart_price_total_zero() && ! $this->is_free_trial_cart() ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -431,7 +435,7 @@ class SmartButton implements SmartButtonInterface {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $this->is_cart_price_total_zero() ) {
|
if ( $this->is_cart_price_total_zero() && ! $this->is_free_trial_cart() ) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -440,6 +444,7 @@ class SmartButton implements SmartButtonInterface {
|
||||||
if (
|
if (
|
||||||
is_cart()
|
is_cart()
|
||||||
&& ! $not_enabled_on_cart
|
&& ! $not_enabled_on_cart
|
||||||
|
&& ! $this->is_free_trial_cart()
|
||||||
) {
|
) {
|
||||||
add_action(
|
add_action(
|
||||||
$this->proceed_to_checkout_button_renderer_hook(),
|
$this->proceed_to_checkout_button_renderer_hook(),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue