Webworkz Plugins Documentation
Using the Donate Form shortcode
A customisable ‘donate’ form where a visitor to your site can make a one-time payment, selecting the amount to pay, currency and (optionally) email address.
The shortcode [mswr_donate_form] inserts the pre-built form and initiates a Stripe payment.
To find out more about using WordPress shortcodes, see this guide.
You can add shortcode parameters to customise the donate form’s behavior. For a comprehensive list of available parameters and their default values, please also refer to the Parameters Reference.
The following parameters are available in the Donate Form shortcode:
Customise the form parameters
(may also be modified programatically. See Using a Filter Hook)
Parameter | Type | Required | Default Value | |
---|---|---|---|---|
amount |
integer |
No | 10 | The initial value of the amount field in the form in the currency’s primary unit (ie. $). |
currency |
string |
No | 'usd' |
The initial value in the currency dropdown. ISO 4217 format (e.g., ‘usd’, ‘eur’). |
email |
string |
No | ” | The customer’s email address. Pre-fills the form field. |
product |
string |
No | 'Product' |
The name of the product that appears in the Stripe Checkout. |
success_url |
string |
No | plugin settings |
URL to redirect the user to upon successful payment. |
cancelled_url |
string |
No | plugin settings |
URL to redirect the user to if the payment is cancelled. |
user_meta |
string or array of string |
No | '' |
User defined tag which can be used to identify a transaction in, or pass information to the webhook callback handler |
Customise the form appearance
Parameter | Type | Required | Default Value | |
---|---|---|---|---|
form_label |
string |
No | Make a Donation |
The donate-form title. |
button_label |
string |
No | Donate |
The donate-form button text. |
amount_label |
string |
No | Amount |
The donate-form amount-field label. |
email_label |
string |
No | Email (optional) |
The donate-form email-field label. |
currency_label |
string |
No | Currency |
The donate-form currency-field label. |
Example usage:
[mswr_donate_form amount="20" product="My Crowdsourced Donation" currency="nzd" user_meta="website donate form" form_title="Please Donate" button_label="Donate Now!"]
Show a Donate Form with the following attributes:
- Amount: 20.00 – Initial value of the Amount field in $. May be changed on the front end.
- Currency: nzd – Initial value of the Currency dropdown. May be changed on the front end.
- Product: My Crowdsourced Donation (appears in the Checkout Form and the transaction log)
- user_meta: website donate form (appears in the Tranasction log and is available in the filter hook {mswr_transaction_complete}
- Form Title: Please Donate
- Button Text: Donate Now!