mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
Hide non updatable form fields if subscription product connected to PayPal
This commit is contained in:
parent
8c407546a3
commit
09c7537e48
3 changed files with 15 additions and 9 deletions
|
@ -91,6 +91,9 @@ class SingleProductBootstap {
|
|||
}
|
||||
|
||||
priceAmountIsZero() {
|
||||
if(subscriptionHasPlan()) {
|
||||
return false;
|
||||
}
|
||||
const price = this.priceAmount();
|
||||
return !price || price === 0;
|
||||
}
|
||||
|
|
|
@ -8,18 +8,15 @@ document.addEventListener(
|
|||
const subscriptionPeriod = document.querySelector('#_subscription_period');
|
||||
subscriptionPeriod.setAttribute('disabled', 'disabled');
|
||||
|
||||
const subscriptionLength = document.querySelector('#_subscription_length');
|
||||
subscriptionLength.setAttribute('disabled', 'disabled');
|
||||
const subscriptionLength = document.querySelector('._subscription_length_field');
|
||||
subscriptionLength.style.display = 'none';
|
||||
|
||||
const subscriptionTrialLength = document.querySelector('#_subscription_trial_length');
|
||||
subscriptionTrialLength.setAttribute('disabled', 'disabled');
|
||||
|
||||
const subscriptionTrialPeriod = document.querySelector('#_subscription_trial_period');
|
||||
subscriptionTrialPeriod.setAttribute('disabled', 'disabled');
|
||||
const subscriptionTrial = document.querySelector('._subscription_trial_length_field');
|
||||
subscriptionTrial.style.display = 'none';
|
||||
}
|
||||
|
||||
const unlinkBtn = document.getElementById('ppcp_unlink_sub_plan');
|
||||
unlinkBtn.addEventListener('click', (event)=>{
|
||||
unlinkBtn?.addEventListener('click', (event)=>{
|
||||
event.preventDefault();
|
||||
unlinkBtn.disabled = true;
|
||||
const spinner = document.getElementById('spinner-unlink-plan');
|
||||
|
@ -59,6 +56,9 @@ document.addEventListener(
|
|||
const planUnlinked = document.getElementById('pcpp-plan-unlinked');
|
||||
planUnlinked.style.display = 'block';
|
||||
|
||||
setTimeout(() => {
|
||||
location.reload();
|
||||
}, 1000)
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -56,7 +56,10 @@ trait FreeTrialHandlerTrait {
|
|||
|
||||
$product = wc_get_product();
|
||||
|
||||
if ( ! $product || ! WC_Subscriptions_Product::is_subscription( $product ) ) {
|
||||
if (
|
||||
! $product || ! WC_Subscriptions_Product::is_subscription( $product )
|
||||
|| $product->get_meta( '_ppcp_enable_subscription_product' ) === 'yes'
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue