- Handle Custom Stripe Webhook Events
- suredonation_export_secret_option_keys Filter Hook
- suredonation_import_batch_complete Action Hook
- suredonation_import_complete Action Hook
- suredonation_import_donation_inserted Action Hook
- suredonation_import_donor_inserted Action Hook
- suredonation_import_session_created Action Hook
- suredonation_import_givewp_batch_complete Action Hook
- suredonation_import_givewp_session_created Action Hook
- suredonation_privacy_data_exported Action Hook
- Validate Field Filter Hook
- Validatable Blocks Filter Hook
- Update donation data, Filter Hook
- OttoKit Integration: suredonation_suretriggers_integration_data_filter Filter Hook
- suredonation_show_setup_gateway_notice Filter Hook
- suredonation_show_review_notice_gateway Filter Hook
- suredonation_show_review_notice_donation Filter Hook
- suredonation_registered_payment_methods Filter Hook
- suredonation_register_additional_blocks Filter Hook
- suredonation_receipt_html Filter Hook
- suredonation_phone_geo_enabled Filter Hook
- suredonation_phone_geo_api_hourly_cap Filter Hook
- suredonation_paypal_webhook_handle_event Filter Hook
- suredonation_paypal_sdk_args Filter Hook
- suredonation_output_campaign_meta_tags Filter Hook
- suredonation_new_donor_user_data Filter Hook
- suredonation_integration_payload Filter Hook
- suredonation_import_phase_mappers Filter Hook
- suredonation_import_givewp_phases Filter Hook
- suredonation_import_givewp_phase_mappers Filter Hook
- suredonation_import_donation_row Filter Hook
- suredonation_import_campaigns_limit Filter Hook
- suredonation_field_block_config Filter Hook
- suredonation_export_one_time_only Filter Hook
- suredonation_export_campaigns_limit Filter Hook
- suredonation_email_smart_tags Filter Hook
- suredonation_email_smart_tag_groups Filter Hook
- suredonation_email_field_char_limits Filter Hook
- suredonation_disable_default_styles Filter Hook
- suredonation_default_validation_messages Filter Hook
- suredonation_default_email_notifications Filter Hook
- suredonation_create_donation_data Filter Hook
- suredonation_config_abilities Filter Hook
- suredonation_available_payment_methods Filter Hook
- suredonation_allowed_form_html Filter Hook
- suredonation_allowed_form_blocks Filter Hook
- Validatable Blocks Filter Hook
- Update donation data, Filter Hook
- OttoKit Integration: suredonation_suretriggers_integration_data_filter Filter Hook
- suredonation_show_setup_gateway_notice Filter Hook
- suredonation_show_review_notice_gateway Filter Hook
- suredonation_show_review_notice_donation Filter Hook
- suredonation_registered_payment_methods Filter Hook
- suredonation_register_additional_blocks Filter Hook
- suredonation_receipt_html Filter Hook
- suredonation_phone_geo_enabled Filter Hook
- suredonation_phone_geo_api_hourly_cap Filter Hook
- suredonation_paypal_webhook_handle_event Filter Hook
- suredonation_paypal_sdk_args Filter Hook
- suredonation_output_campaign_meta_tags Filter Hook
- suredonation_new_donor_user_data Filter Hook
- suredonation_integration_payload Filter Hook
- suredonation_import_phase_mappers Filter Hook
- suredonation_import_givewp_phases Filter Hook
- suredonation_import_givewp_phase_mappers Filter Hook
- suredonation_import_donation_row Filter Hook
- suredonation_import_campaigns_limit Filter Hook
- suredonation_field_block_config Filter Hook
- suredonation_export_secret_option_keys Filter Hook
- suredonation_export_one_time_only Filter Hook
- suredonation_export_campaigns_limit Filter Hook
- suredonation_email_smart_tags Filter Hook
- suredonation_email_smart_tag_groups Filter Hook
- suredonation_email_field_char_limits Filter Hook
- suredonation_disable_default_styles Filter Hook
- suredonation_default_validation_messages Filter Hook
- suredonation_default_email_notifications Filter Hook
- suredonation_create_donation_data Filter Hook
- suredonation_config_abilities Filter Hook
- suredonation_available_payment_methods Filter Hook
- suredonation_allowed_form_html Filter Hook
- suredonation_allowed_form_blocks Filter Hook
- suredonation_import_batch_complete Action Hook
- suredonation_import_complete Action Hook
- suredonation_import_donation_inserted Action Hook
- suredonation_import_donor_inserted Action Hook
- suredonation_import_session_created Action Hook
- suredonation_import_givewp_batch_complete Action Hook
- suredonation_import_givewp_session_created Action Hook
- suredonation_privacy_data_exported Action Hook
- suredonation_enqueue_form_frontend_scripts Action Hook
- suredonation_after_form_duplicated Action Hook
- suredonation_email_sent Action Hook
- suredonation_donor_user_created Action Hook
- suredonation_donation_refunded Action Hook
- suredonation_donation_status_changed Action Hook
- suredonation_donation_completed Action Hook
- suredonation_new_donation Action Hook
- suredonation_donation_created Action Hook
suredonation_receipt_html Filter Hook
Overview
The suredonation_receipt_html filter allows developers to modify the HTML used to generate SureDonation donation receipt PDFs.
The filter runs immediately before the generated HTML is passed to the mPDF PDF engine. You can use it to customize the receipt layout, add additional information, or modify the existing receipt content.
When to Use This Filter
Use this filter when you need to customize the content or appearance of donation receipts.
For example, you can use it to:
- Add a custom footer.
- Add organization information.
- Add a thank-you message.
- Modify receipt content.
- Add custom HTML elements.
- Customize the receipt layout and styling.
Filter Signature
apply_filters( 'suredonation_receipt_html', $html, $donation, $donor);Parameters
| Parameter | Type | Description |
| $html | string | The receipt HTML generated by SureDonation. |
| $donation | array | The donation record associated with the receipt. |
| $donor | array|null | The donor record. Returns null when no donor is associated with the donation. |
Return Value
Return the modified receipt HTML as a string.
The returned HTML is passed to the PDF engine and used to generate the final donation receipt.
Basic Usage
Use add_filter() to register your callback.
add_filter( 'suredonation_receipt_html', 'your_custom_function', 10, 3 );
function your_custom_function( $html, $donation, $donor ) {
    // Modify the receipt HTML here.
    return $html;
}Example: Add a Custom Footer
The following example adds a thank-you message to the bottom of the receipt.
add_filter( Â 'suredonation_receipt_html', 'mysite_add_receipt_footer', 10, 3);
function mysite_add_receipt_footer( $html, $donation, $donor ) {
    $footer = '<p style="text-align:center;">Thank you for supporting our mission.</p>';
    return str_replace(
        '</body>',
        $footer . '</body>',
        $html
    );
}Example: Add Donation Information
You can use the $donation and $donor parameters to add additional information to the receipt.
add_filter( 'suredonation_receipt_html', Â 'mysite_add_receipt_note', 10, 3);
function mysite_add_receipt_note( $html, $donation, $donor ) {
    $note = '<p style="text-align:center;">Donation received successfully.</p>';
    return str_replace(
        '</body>',
        $note . '</body>',
        $html
    );
}Receipt Generation Flow
The filter is part of the receipt generation process:
- SureDonation prepares the donation receipt data.
- SureDonation generates the receipt HTML.
- The suredonation_receipt_html filter is applied.
- Your callback can modify the generated HTML.
- The filtered HTML is passed to mPDF.
- mPDF generates the donation receipt PDF.
Security Considerations
Important: The filtered HTML is passed directly to mPDF’s WriteHTML() method.
mPDF can process HTML elements such as <img> tags and may load resources referenced through file:// URIs or external resources.
Only add trusted and properly escaped content to the receipt HTML.
Avoid inserting untrusted user input directly into the HTML.
For example, when adding dynamic text, sanitize or escape the value before inserting it into the receipt.
$name = isset( $donor['name'] )
    ? esc_html( $donor['name'] )
    : '';
$note = '<p>Thank you, ' . $name . '.</p>';Related Hooks
- suredonation_email_smart_tags: Filters the smart tags available for SureDonation email content.
We don't respond to the article feedback, we use it to improve our support content.