Disables the PayPal gateway when the cart contains multiple items. PayPal disabled the ability to purchase multiple subscriptions in a single purchase.
<?php
/*
 * Plugin Name: Easy Digital Downloads - Disable PayPal for Multi-Item Checkout
 * Description: Disables the PayPal gateway when the cart contains multiple items. PayPal disabled the ability to purchase multiple subscriptions in a single purchase.
 * Author: Easy Digital Downloads
 * Author URI: https://easydigitaldownloads.com/
 * Version: 1.1
 */
function pw_edd_disable_paypal_on_multi_item_checkout( $gateways ) {

	global $wp_query;

	if ( ! empty( $wp_query ) && edd_is_checkout() && count( edd_get_cart_contents() ) > 1 ) {
		$paypal_gateways = array(
			'paypal',
			'paypalexpress',
			'paypalpro',
			'paypal_commerce',
		);

		foreach ( $paypal_gateways as $paypal ) {
			if ( ! empty( $gateways[ $paypal ] ) ) {
				unset( $gateways[ $paypal ] );
			}
		}
	}

	return $gateways;
}
add_filter( 'edd_enabled_payment_gateways', 'pw_edd_disable_paypal_on_multi_item_checkout' );
To implement this snippet on your site, we recommend you use the best code snippets plugin for Wordpress, WPCode.com