mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
Hide the subscription option without js
It was causing js error + no reason to use js for this
This commit is contained in:
parent
8ebeeeca1b
commit
59472bf140
5 changed files with 13 additions and 30 deletions
|
@ -69,9 +69,5 @@
|
|||
togglePayLater()
|
||||
|
||||
vaultingCheckboxes.forEach(node => node.addEventListener('change', togglePayLater));
|
||||
|
||||
if(PayPalCommerceGatewaySettings.is_subscriptions_plugin_active !== '1') {
|
||||
document.getElementById('field-subscription_behavior_when_vault_fails').style.display = 'none';
|
||||
}
|
||||
}
|
||||
);
|
||||
|
|
|
@ -22,6 +22,7 @@ use WooCommerce\PayPalCommerce\Button\Helper\MessagesDisclaimers;
|
|||
use WooCommerce\PayPalCommerce\Onboarding\Environment;
|
||||
use WooCommerce\PayPalCommerce\Onboarding\Render\OnboardingOptionsRenderer;
|
||||
use WooCommerce\PayPalCommerce\Onboarding\State;
|
||||
use WooCommerce\PayPalCommerce\Subscription\Helper\SubscriptionHelper;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Admin\FeesRenderer;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Admin\OrderTablePaymentStatusColumn;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Admin\PaymentStatusOrderDetail;
|
||||
|
@ -401,6 +402,9 @@ return array(
|
|||
$onboarding_options_renderer = $container->get( 'onboarding.render-options' );
|
||||
assert( $onboarding_options_renderer instanceof OnboardingOptionsRenderer );
|
||||
|
||||
$subscription_helper = $container->get( 'subscription.helper' );
|
||||
assert( $subscription_helper instanceof SubscriptionHelper );
|
||||
|
||||
$fields = array(
|
||||
'checkout_settings_heading' => array(
|
||||
'heading' => __( 'Standard Payments Settings', 'woocommerce-paypal-payments' ),
|
||||
|
@ -614,7 +618,7 @@ return array(
|
|||
'subscription_behavior_when_vault_fails' => array(
|
||||
'title' => __( 'Subscription capture behavior if Vault fails', 'woocommerce-paypal-payments' ),
|
||||
'type' => 'select',
|
||||
'class' => array(),
|
||||
'classes' => $subscription_helper->plugin_is_active() ? array() : array( 'hide' ),
|
||||
'input_class' => array( 'wc-enhanced-select' ),
|
||||
'default' => 'void_auth',
|
||||
'desc_tip' => true,
|
||||
|
|
|
@ -9,8 +9,6 @@ declare(strict_types=1);
|
|||
|
||||
namespace WooCommerce\PayPalCommerce\WcGateway\Assets;
|
||||
|
||||
use WooCommerce\PayPalCommerce\Subscription\Helper\SubscriptionHelper;
|
||||
|
||||
/**
|
||||
* Class SettingsPageAssets
|
||||
*/
|
||||
|
@ -30,24 +28,15 @@ class SettingsPageAssets {
|
|||
*/
|
||||
private $version;
|
||||
|
||||
/**
|
||||
* The subscription helper.
|
||||
*
|
||||
* @var SubscriptionHelper
|
||||
*/
|
||||
protected $subscription_helper;
|
||||
|
||||
/**
|
||||
* Assets constructor.
|
||||
*
|
||||
* @param string $module_url The url of this module.
|
||||
* @param string $version The assets version.
|
||||
* @param SubscriptionHelper $subscription_helper The subscription helper.
|
||||
* @param string $module_url The url of this module.
|
||||
* @param string $version The assets version.
|
||||
*/
|
||||
public function __construct( string $module_url, string $version, SubscriptionHelper $subscription_helper ) {
|
||||
$this->module_url = $module_url;
|
||||
$this->version = $version;
|
||||
$this->subscription_helper = $subscription_helper;
|
||||
public function __construct( string $module_url, string $version ) {
|
||||
$this->module_url = $module_url;
|
||||
$this->version = $version;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -110,9 +99,7 @@ class SettingsPageAssets {
|
|||
wp_localize_script(
|
||||
'ppcp-gateway-settings',
|
||||
'PayPalCommerceGatewaySettings',
|
||||
array(
|
||||
'is_subscriptions_plugin_active' => $this->subscription_helper->plugin_is_active(),
|
||||
)
|
||||
array()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -156,8 +156,7 @@ class WCGatewayModule implements ModuleInterface {
|
|||
if ( $c->has( 'wcgateway.url' ) ) {
|
||||
$assets = new SettingsPageAssets(
|
||||
$c->get( 'wcgateway.url' ),
|
||||
$c->get( 'ppcp.asset-version' ),
|
||||
$c->get( 'subscription.helper' )
|
||||
$c->get( 'ppcp.asset-version' )
|
||||
);
|
||||
$assets->register_assets();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue