Home / Admin / Disable PayPal for Multi-Item Checkout
Duplicate Snippet

Embed Snippet on Your Site

Disable PayPal for Multi-Item Checkout

Disables the PayPal gateway when the cart contains multiple items. PayPal disabled the ability to purchase multiple subscriptions in a single purchase.

Code Preview
php
<?php
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' );

Comments

Add a Comment