diff --git a/modules/ppcp-subscription/resources/js/paypal-subscription.js b/modules/ppcp-subscription/resources/js/paypal-subscription.js index 99c1cd630..7d848091f 100644 --- a/modules/ppcp-subscription/resources/js/paypal-subscription.js +++ b/modules/ppcp-subscription/resources/js/paypal-subscription.js @@ -11,6 +11,18 @@ document.addEventListener( children[i].querySelector('.woocommerce_variable_attributes') .getElementsByClassName('wc_input_subscription_period_interval')[0] .setAttribute('disabled', 'disabled'); + children[i].querySelector('.woocommerce_variable_attributes') + .getElementsByClassName('wc_input_subscription_period')[0] + .setAttribute('disabled', 'disabled'); + children[i].querySelector('.woocommerce_variable_attributes') + .getElementsByClassName('wc_input_subscription_trial_length')[0] + .setAttribute('disabled', 'disabled'); + children[i].querySelector('.woocommerce_variable_attributes') + .getElementsByClassName('wc_input_subscription_trial_period')[0] + .setAttribute('disabled', 'disabled'); + children[i].querySelector('.woocommerce_variable_attributes') + .getElementsByClassName('wc_input_subscription_length')[0] + .setAttribute('disabled', 'disabled'); } } } diff --git a/modules/ppcp-subscription/src/SubscriptionModule.php b/modules/ppcp-subscription/src/SubscriptionModule.php index 1ed3d75e5..d2077db06 100644 --- a/modules/ppcp-subscription/src/SubscriptionModule.php +++ b/modules/ppcp-subscription/src/SubscriptionModule.php @@ -842,12 +842,13 @@ class SubscriptionModule implements ModuleInterface { */ private function render_paypal_subscription_fields( WC_Product $product, Environment $environment ): void { $enable_subscription_product = $product->get_meta( '_ppcp_enable_subscription_product' ); + $style = $product->get_type() === 'subscription_variation' ? 'float:left; width:150px;' : ''; echo '

'; echo sprintf( // translators: %1$s and %2$s are label open and close tags. esc_html__( '%1$sConnect to PayPal%2$s', 'woocommerce-paypal-payments' ), - '

' . esc_attr( $subscription_product['id'] ) . '

' ); echo sprintf( // translators: %1$s and %2$s are wrapper html tags. esc_html__( '%1$sPlan%2$s', 'woocommerce-paypal-payments' ), - '

' . esc_attr( $subscription_plan['id'] ) . '

' ); } else { @@ -954,12 +955,12 @@ class SubscriptionModule implements ModuleInterface { return array( 'product_connected' => $product->get_meta( '_ppcp_enable_subscription_product' ) ?? '', - 'plan_id' => $plan_id, - 'product_id' => $product->get_id(), + 'plan_id' => $plan_id, + 'product_id' => $product->get_id(), 'ajax' => array( 'deactivate_plan' => array( - 'endpoint' => \WC_AJAX::get_endpoint( DeactivatePlanEndpoint::ENDPOINT ), - 'nonce' => wp_create_nonce( DeactivatePlanEndpoint::ENDPOINT ), + 'endpoint' => \WC_AJAX::get_endpoint( DeactivatePlanEndpoint::ENDPOINT ), + 'nonce' => wp_create_nonce( DeactivatePlanEndpoint::ENDPOINT ), ), ), );