Skip to content

Instantly share code, notes, and snippets.

@thenbrent
Last active October 31, 2016 20:17
Show Gist options
  • Save thenbrent/6641526 to your computer and use it in GitHub Desktop.
Save thenbrent/6641526 to your computer and use it in GitHub Desktop.
Using WooCommerce and want to disable PayPal for subscription purchases, but still offer it as an option for buying one-off products? Activate this plugin.

This gist has been migrated to a repo here.

@thenbrent
Copy link
Author

@douglsmith as long as you have no active subscriptions with PayPal (and therefore no subscription IPN requests that need to be handled) I think removing PayPal subscriptions class completely should be fine.

Under those circumstances, it's also a much nicer way to do it - thanks for sharing! :)

@shawaj
Copy link

shawaj commented Dec 30, 2013

Thanks guys for this. Really useful.

@shiyam06
Copy link

shiyam06 commented Feb 7, 2014

Hi Guys,

I run a multisite and want my subsite users to user only the IPG I provide. I Want to disable default Payment options in woocommerce like, BANK dep.,cheque, paypa etc. can some one guide me

Regards
George

@KainerW
Copy link

KainerW commented Mar 20, 2014

I searched for 'where to find the slug' and found it by myself in the URL at the end. In Woocommerce/settings/payments click on the payments you can choose from and have a look at the different URLs. For paypal it ends on: wc_gateway_paypal for another: wc_gateway_bacs (e.g. slug for paying by check is 'bacs').

@pandominio
Copy link

good morning experts,
i like this code or plugin. and i use it already on my subscriptions.
Sorry but i am not a expert...so my question is how i can change the code so that I can also use it for "bacs" and costume "wcCpg1". Thanks for your Help.
regards
Carsten

@infitechelectronics
Copy link

Hi, where do I insert this code? Does it go in the functions.php file of my theme?
Thanks!
Sebastian

@infitechelectronics
Copy link

I was able to do it, just created a new folder inside the wp-content/plugins folder, named: "woocommerce-disable-paypal-for-subscriptions" and placed the woocommerce-disable-paypal-for-subscriptions.php file with the code above inside the folder. Just a comment: the code is missing the ?> at the end.

Then simply go to your plugins in WordPress and activate it!

Sorry if this is too simple, but it may help others :)

@caschen
Copy link

caschen commented May 31, 2015

Hi,
Does this plugin still allow existing active subscriptions to be renewed via Paypal? Will it only stop new Paypal customers subscribing?
Thanks

@hxxrmonkey
Copy link

Thank you SO MUCH for this, spent hours trying to figure out where the form for a change of payment method with $0 balance was being pulled from so I could disable paypal there (successful initial signup with $0 due, and changing payment method before first renewal charge hits), and as a bonus stumbled upon a wealth of other snippets useful for for the sub plugin. Thanks! (I know you're the author, I wish I had bothered to look here first before I spent hours sorting through code... have bookmarked it now!)

@douglsmith
Copy link

An update for others who may find this, the shorter solution I posted above no longer works in Subscriptions 2.x.

@robin-scott
Copy link

This plugin works with 2.0 though? We're just adding it to a site which is heading towards 2.0.

@robin-scott
Copy link

Okay, this works, in checkout, but has been pointed out today that it doesn't remove it from the "Update Payment" screen in My Account > Subscriptions. About to roll sleeves up and add that... unless anyone has already fixed that?! ;)

@thenbrent
Copy link
Author

Hi folks, given the amount of discussion on this gist, I'm moved it to a GitHub repo where it's history is more easily traced and we can use Issues etc. to track discussions. Find it here: https://github.com/Prospress/woocommerce-subscriptions-disable-paypal

@hoobsi
Copy link

hoobsi commented Oct 31, 2016

Good point by silicondales!
Does anyone know a way of how to also remove paypal in the MyAccount > Update Payment section? That would be amazing.
Sorry for posting on here thenbrent but I could not see any posts under the other link :/
Any help would be massively appreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment