WordPress PayPal Donations Button Addition Guide

Learn how to add a WordPress PayPal donations button to your WordPress sidebar widget and shortcode to add on pages and posts in an easy way.

By Claudio Pires
Updated on July 25, 2022
WordPress PayPal Donations Button Addition Guide

Learn how to add a WordPress PayPal donations button to your WordPress sidebar widget and shortcode to add on pages and posts in an easy way. The options menu lets you set up your PayPal ID and a few other optional settings.

You can choose which PayPal donation button you want to use or if you want to use your own button. You can also set an optional default purpose and reference which can be overridden on each inserted instance with the widget and shortcode options. There are also settings for currency, custom payment page style, and the return page.

PayPal Donations Widget Plugin Installation

  • Go to the Add New plugins screen in your WordPress admin area
  • Click the upload tab
  • Browse for the plugin file (paypal-donations.zip)
  • Click Install Now and then activate the plugin

Plugin Usage

Go to the “PayPal donations” menu link from the WordPress dashboard settings menu after you install and activate the plugin:

Plugin Usage

Admin Page Configuration

You need to enter some details for the donation and your PayPal account from the admin interface of the plugin:

WordPress PayPal Donations Button Plugin settings page

 PayPal Account

Your PayPal Email or Secure Merchant Account ID. The donations will go directly to this PayPal account.

Currency For WordPress PayPal Donations Button

Select the currency the donations will be made in.

Page Style (optional)

The custom page style that associated with the donation button when arriving at the PayPal payment page.

Login to PayPal -> Profile -> Selling Preferences -> Custom Payment Pages, to design your own page style.

Note: Some PayPal accounts have this option located in this place instead:
My Account -> Profile -> My selling tools -> Selling online -> Custom payment pages.

Return Page (optional)

An URL where the user will be returned after completing the payment. For example, a URL on your site that hosts a “Thank you for your donation” page.

Amount (optional) WordPress PayPal Donations Button

Set a default amount to be used by the plugin. Use numbers only, like 9.95 or 20 without any currency symbol.

Purpose (optional) WordPress PayPal Donations Button

Here you can enter a default purpose for the donation. You can override this purpose when inserting a specific button by using the purpose=”” argument in the shortcode. If no purpose is defined, the user will get the possibility to enter a purpose on PayPal’s payment page.

Reference (optional)

Here you can enter a default reference for the donation. You can override this reference when inserting a specific button by using the reference=”” argument in the shortcode.

Select WordPress PayPal Donations Button

Here you can select between PayPals’ three default buttons, or enter an URL to a custom button of your own to use instead.
The last option in this section is language and country. It lets you localize the graphics of the button to use any of PayPal’s available buttons with translated button graphics. By choosing your country when using the button with credit card symbols, they will be ready to the ones appropriate for the country.

Extras

  • Disable PayPal Statistics Enable this to not load the hidden image PayPal uses for statistics. Moreover, we do recommend loading the statistics image, but for speed purposes, it can be off with this option.
  • Theme CSS Override: Center Button If the theme you are using do not center form buttons, but you want the Donate button centered, enable this option to center your WordPress PayPal donations button.
  • Set Checkout Language Enable this to override any potential PayPal language cookie the person to donate might have set in the browser, and control the language used for the first PayPal checkout page.

The Donations Sidebar Widget

Go to the Appearance -> Widgets menu from your admin dashboard to add a donations widget to your sidebar. You can enter a few optional settings for the widget.

  • Firstly, a title to appear on the Widget (defaults to Donate)
  • Secondly, a descriptive text to appear above the button (it automatically adds <p></p> around it on display.
  • Purpose to override the default purpose.
  • Finally, Reference to override the default reference.
WordPress PayPal Donations Button - Widget

The Donations Widget Shortcode

You can also use a shortcode to add the donations widget to a WordPress post or page.

Insert the button in your pages or posts with the following shortcode:

[paypal-donation]

Which is the simplest option, and uses all default and optional settings of your PayPal donations button. If you want to make a specific button for a specific purpose you can add the following parameters in the shortcode. Here is an example:

[paypal-donation purpose=”Spline Importer” reference=”LW3D Plugins”]

Available arguments for the shortcode: purpose, reference, amount, return_page and button_url.

All the Visualmodo WordPress themes are tested and fully compatible with the donation plugin and system.

Using The Donations Widgets in Your Theme’s Template File

Use the following PHP code in your theme’s template file:

<?php echo do_shortcode('[paypal-donation]'); ?>

or the following (if you wanted to use custom parameters):

<?php echo do_shortcode('[paypal-donation purpose="Donation Purpose" reference="Sample Reference"]'); ?>

Filters and Hooks

The following filters are available for hooking into the plugin:

  • paypal_donations_amount Filters the predefined amount before the button is generated.
  • paypal_donations_url Filters the URL the form points to. Useful to change to the PayPal sandbox URL for testing the button.
  • paypal_donations_purpose_html Filters the default hidden form input element for the purpose.

Example Code For WordPress PayPal Donations Button

function change_donation_amount( $amount ) {
// Do something
return $amount;
}
add_filter('paypal_donations_amount', 'change_donation_amount', 10, 1);

function change_paypal_url( $url ) {
// Do something
return $url;
}
add_filter('paypal_donations_url', 'change_paypal_url', 10, 1);

// Add a drop down menu for donation purposes
function paypal_purpose( $purpose ) {
return '
<select name="item_name">
<option value="Donation Purpose 1">Donation Purpose 1</option>
<option value="Donation Purpose 2">Donation Purpose 2</option>
</select>
';
}
add_filter( 'paypal_donations_purpose_html', 'paypal_purpose' );
Claudio Pires

Claudio Pires is the co-founder of Visualmodo, a renowned company in web development and design. With over 15 years of experience, Claudio has honed his skills in content creation, web development support, and senior web designer. A trilingual expert fluent in English, Portuguese, and Spanish, he brings a global perspective to his work. Beyond his professional endeavors, Claudio is an active YouTuber, sharing his insights and expertise with a broader audience. Based in Brazil, Claudio continues to push the boundaries of web design and digital content, making him a pivotal figure in the industry.