Sometimes there is a payment method that you cannot accept based on delivery method. For example, if you are personally delivering an item directly to the customer and would prefer they pay at time of delivery, you may want to remove their option to pay online so they do not select it. Because some shipping methods can return more than one option (such as our Table Rate Shipping plugin), this function will compare the title of the selected shipping option rather than the method it came from.
The following code snippet will check the option the user has selected. If they have chosen an option with the title ‘Home Delivery’, the payment option for PayPal will be removed. WooCommerce 2.1+