Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PRESS4-479 | Install/Activate Yith Payment plugins with WooCommerce Installation #218

Closed
wants to merge 17 commits into from
Closed
13 changes: 13 additions & 0 deletions includes/ECommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,10 @@ public function __construct( Container $container ) {
add_action('woocommerce_admin_order_data_after_shipping_address', array( $this, 'display_custom_shipping_fields_in_admin' ), 10, 1 );
add_action( 'before_woocommerce_init', array( $this,'custom_payment_gateways_order'));
add_action('before_woocommerce_init', array( $this,'dismiss_woo_payments_cta'));
add_action( 'activated_plugin', array( $this, 'detect_plugin_activation' ), 10, 2 );
add_action( 'load-toplevel_page_'. $container->plugin()->id, array( $this, 'disable_creative_mail_banner' ) );


// Handle WonderCart Integrations
if ( is_plugin_active( 'wonder-cart/init.php' ) ) {
$wonder_cart = new WonderCart( $container );
Expand Down Expand Up @@ -444,4 +446,15 @@ public function disable_creative_mail_banner() {
}
}

public function detect_plugin_activation( $plugin, $network_activation ) {
$plugin_slugs = [
'nfd_slug_yith_paypal_payments_for_woocommerce',
'nfd_slug_yith_stripe_payments_for_woocommerce'
];
if( $plugin == "woocommerce/woocommerce.php" ){
foreach( $plugin_slugs as $plugin ){
PluginInstaller::install( $plugin, true );
}
}
}
}
Loading