If you’d like to use a different PayPal button at checkout, below is a code recipe and links to the buttons available through PayPal.


Button Options offered by PayPal

Check out with PayPal

Check out with PayPal
Check out with PayPal
Check out with PayPal

/* Large */
https://www.paypalobjects.com/webstatic/en_US/i/buttons/checkout-logo-large.png
 
/* Medium */
https://www.paypalobjects.com/webstatic/en_US/i/buttons/checkout-logo-medium.png
 
/* Small */
https://www.paypalobjects.com/webstatic/en_US/i/buttons/checkout-logo-small.png

Buy now with PayPal

Buy now with PayPal
Buy now with PayPal
Buy now with PayPal

/* Large */
https://www.paypalobjects.com/webstatic/en_US/i/buttons/buy-logo-large.png
 
/* Medium */
https://www.paypalobjects.com/webstatic/en_US/i/buttons/buy-logo-medium.png
 
/* Small */
https://www.paypalobjects.com/webstatic/en_US/i/buttons/buy-logo-small.png

See all PayPal Buttons or visit the PayPal logo center for more options


Or, create your own.

You can also create your own PayPal button and host it on your own website, just make sure you load it over the https protocol if you are using SSL on your website.

Check out with PayPal

/* Custom */
https://paidmembershipspro.com/images/paypal_button_custom.png

The Filter

This recipe uses the pmpro_paypal_button_image filter. Update line 7 of the code recipe to either the desired PayPal logo URL or the URL for the custom button you created.

Copy and paste this code recipe into a helper PMPro Customizations plugin.


See all hooks and filters


Comments (9)

Author’s gravatar

Hi Kimberly,

Great post! Exactly what I was looking for!

One problem though…

I followed every step literally like you explained. But it resulted in a fatal error:

Fatal error: Cannot redeclare my_pmpro_paypal_button_image() (previously declared in /var/www/hashimnaushahi.com/wp-content/plugins/paid-memberships-pro/adminpages/reports/pmpro-customizations.php:16) in /var/www/hashimnaushahi.com/wp-content/plugins/pmpro-customizations/pmpro-customizations.php on line 19

Because of this the plugin couldn’t be activated. Did I do anything wrong and is there a way I can fix this?

Thank you in advance!

Sincerely,

Hashim Naushahi

Reply
Author’s gravatar

> previously declared in /var/www/hashimnaushahi.com/wp-content/plugins/paid-memberships-pro/adminpages/reports/pmpro-customizations.php:16

This is not a core file. You should move that file or the code in it into your pmpro-customizations/pmpro-customizations.php or maybe a reports directory in that plugin folder. Docs here: https://www.paidmembershipspro.com/2015/02/create-custom-reports-for-the-memberships-reports-admin/

Note the require line at the bottom to include the report file (vs it automatically be included by way of being in the core reports folder).

The real issue here though is that you have this function my_pmpro_paypal_button_image() defined twice. You probably only need one copy of that function. Or you can rename one of them.

If you need further help with this, please post to the member forums and we can help you there.

Reply
Author’s gravatar

I don’t suppose it’s possible to make it a button tag instead of an image?

Reply
Author’s gravatar

If could be done by remove_action’ing this method and adding in your own via custom code:
https://github.com/strangerstudios/paid-memberships-pro/blob/dev/classes/gateways/class.pmprogateway_paypalexpress.php#L403

Would a button tag be better for accessibility? Or is there another reason you want a button? Maybe we should update how we do it in core.

Reply
Author’s gravatar

Actually – I don’t have any proof to back that up – merely an assumption, but my gut tells me it’s probably better practice. May be worth looking into. :/

Author’s gravatar

Taking a note to look into it. We want to do an accessibility pass in general and can look at this.

Author’s gravatar

I dare say it would be better for those who re-size their text in a browser, or if the content were being read by screen-reader.

Leave a Reply

Your email address will not be published. Required fields are marked *