Payment Gateways: Hide PayPal When Autoship Products Are In the Cart

Uses the function 'autoship_cart_has_valid_autoship_items' to hide PayPal as a payment option when 1 or more products that are scheduled for Autoship are in the cart.

Important: Always test customizations to your site on a staging environment before making changes to your live / production site.  If you are not experienced with testing changes on a staging site, here is a good article to review.

* Disable Paypal Express when 1+ Autoship Items are in the cart.
* NOTE: This is specific to the WooCommerce Paypal Express Gateway by WooCommerce
* @param array $_available_gateways The current available gateways
* @return array The filtered setting.
function xx_hide_paypal_express_on_autoship( $_available_gateways ){

    // if Autoship is not installed or no autoship return original else return based on autoship in cart.
    if ( function_exists( 'autoship_cart_has_valid_autoship_items' ) && autoship_cart_has_valid_autoship_items() )
    unset( $_available_gateways['ppec_paypal'] );

    return $_available_gateways;

add_filter( 'woocommerce_available_payment_gateways', 'xx_hide_paypal_express_on_autoship', 10, 1 );

Note: The gist uses the woocommerce_available_payment_gateways hook.