mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-04 08:47:23 +08:00
Consider manual renewal and vaulting option when displaying buttons on product page
This commit is contained in:
parent
3163593027
commit
cf68af182c
2 changed files with 22 additions and 5 deletions
|
@ -233,11 +233,15 @@ class SingleProductBootstap {
|
||||||
this.form(),
|
this.form(),
|
||||||
this.errorHandler
|
this.errorHandler
|
||||||
);
|
);
|
||||||
|
if (
|
||||||
if(!this.gateway.vaultingEnabled){
|
! this.gateway.vaultingEnabled &&
|
||||||
return;
|
[ 'subscription', 'variable-subscription' ].includes(
|
||||||
}
|
this.gateway.productType
|
||||||
|
) &&
|
||||||
|
this.gateway.manualRenewalEnabled !== '1'
|
||||||
|
) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
PayPalCommerceGateway.data_client_id.has_subscriptions &&
|
PayPalCommerceGateway.data_client_id.has_subscriptions &&
|
||||||
|
|
|
@ -1318,8 +1318,21 @@ document.querySelector("#payment").before(document.querySelector(".ppcp-messages
|
||||||
'should_handle_shipping_in_paypal' => $this->should_handle_shipping_in_paypal && ! $this->is_checkout(),
|
'should_handle_shipping_in_paypal' => $this->should_handle_shipping_in_paypal && ! $this->is_checkout(),
|
||||||
'needShipping' => $this->need_shipping(),
|
'needShipping' => $this->need_shipping(),
|
||||||
'vaultingEnabled' => $this->settings->has( 'vault_enabled' ) && $this->settings->get( 'vault_enabled' ),
|
'vaultingEnabled' => $this->settings->has( 'vault_enabled' ) && $this->settings->get( 'vault_enabled' ),
|
||||||
|
'productType' => null,
|
||||||
|
'manualRenewalEnabled' => '',
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if ( is_product() ) {
|
||||||
|
$product = wc_get_product( get_the_ID() );
|
||||||
|
if ( is_a( $product, \WC_Product::class ) ) {
|
||||||
|
$localize['productType'] = $product->get_type();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( class_exists( '\WCS_Manual_Renewal_Manager' ) ) {
|
||||||
|
$localize['manualRenewalEnabled'] = \WCS_Manual_Renewal_Manager::is_manual_renewal_enabled();
|
||||||
|
}
|
||||||
|
|
||||||
if ( 'pay-now' === $this->context() ) {
|
if ( 'pay-now' === $this->context() ) {
|
||||||
$localize['pay_now'] = $this->pay_now_script_data();
|
$localize['pay_now'] = $this->pay_now_script_data();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue