Summary
By default, MemberPress does not include a built-in setting to disable PDF invoice downloads based on payment method. When using the MemberPress PDF Invoice Add-On, PDF invoices are generated for all transactions regardless of gateway.
This document explains how to disable PDF invoice downloads specifically for the Offline Gateway and optionally the Manual gateway using custom PHP code. This is a common requirement when offline transactions are invoiced separately in an external accounting system, and generating a MemberPress PDF invoice would create duplicate or misleading records.
The solution covers blocking the PDF download request, removing the PDF link from the frontend account table and wp-admin, preventing PDF email attachments, and removing the ReadyLaunch print button — while leaving all other gateways such as Stripe or PayPal unaffected.
Troubleshooting
Prerequisites and Important Notes
Before proceeding, review the following requirements and limitations.
Requirements:
- MemberPress PDF Invoice Add-On must be installed and active;
- Access to add custom PHP code via a code snippet plugin or child theme;
- A staging environment for testing before applying changes to production;
Important limitations:
- MemberPress does not natively support filtering PDF invoices by payment method;
- MemberPress Support cannot create, modify, or maintain custom code;
- Always back up your site before adding custom code;
- If further customization is needed, consult a developer or a certified MemberPress partner;
Disabling PDF Invoices for Offline and Manual Payments
1) PDF Invoice Link Appears for Offline or Manual Transactions
When the PDF Invoice Add-On is active, a PDF download link appears in the Account Payments table and in wp-admin for all transactions, including those processed through the Offline or Manual gateways. There is no built-in setting to suppress this per gateway.
How to Test/Fix:
Add the following custom code snippet using Code Snippets, WPCode, or your child theme’s functions.php file.
The code performs the following actions:
- Blocks the AJAX PDF download request for Offline and Manual transactions, returning a 403 error;
- Prevents PDF attachments from being added to receipt emails for those transactions;
- Hides the “PDF” link in the frontend Account → Payments table and shows a dash instead;
- Removes the “PDF Invoice” action link from the wp-admin transaction row;
- Removes the ReadyLaunch “Print” button for those transactions;
// MemberPress: Disable/hide PDF invoices for Offline (Artificial) and Manual gateways.
// Modify the mepr_should_disable_pdf_for_txn() function to target a different gateway if needed.
if (!function_exists('mepr_should_disable_pdf_for_txn')) {
function mepr_should_disable_pdf_for_txn(MeprTransaction $txn) {
$pm = $txn->payment_method();
$pm_key = (is_object($pm) && isset($pm->key)) ? $pm->key : '';
// Offline gateway has key 'offline'; Manual static gateway is 'manual'
if ($pm_key === 'offline') { return true; }
if ($txn->gateway === MeprTransaction::$manual_gateway_str) { return true; }
return false;
}
}
// 1) Block account/admin AJAX PDF download for Offline/Manual.
add_action('wp_ajax_mepr_download_invoice', function () {
if (!isset($_REQUEST['action']) || $_REQUEST['action'] !== 'mepr_download_invoice') { return; }
if (empty($_REQUEST['txn'])) { return; }
$txn = new MeprTransaction((int) $_REQUEST['txn']);
if ($txn->id <= 0) { return; }
if (mepr_should_disable_pdf_for_txn($txn)) {
wp_die(
__('PDF invoices are not available for offline payments.', 'memberpress'),
__('Invoice Not Available', 'memberpress'),
array('response' => 403)
);
}
}, 0);
// 2) Prevent PDF attachments in receipt emails for Offline/Manual.
add_filter('mepr_transaction_email_params', function ($params, $txn) {
if ($txn instanceof MeprTransaction && mepr_should_disable_pdf_for_txn($txn)) {
unset($params['pdf_txn']); // stops the add-on from generating/attaching PDFs
}
return $params;
}, 20, 2);
// 3) Remove add-on's "Download" header/cell hooks and replace with conditional ones
// (hide for offline/manual, show for all other gateways).
add_action('plugins_loaded', function () {
// Helper to remove class method callbacks without instance reference.
if (!function_exists('mepr_remove_class_action')) {
function mepr_remove_class_action($hook, $class, $method) {
global $wp_filter;
if (empty($wp_filter[$hook]) || !isset($wp_filter[$hook]->callbacks)) { return; }
foreach ((array) $wp_filter[$hook]->callbacks as $priority => $callbacks) {
foreach ($callbacks as $cb) {
if (is_array($cb['function'])
&& is_object($cb['function'][0])
&& get_class($cb['function'][0]) === $class
&& $cb['function'][1] === $method
) {
remove_action($hook, $cb['function'], $priority);
}
}
}
}
}
// Remove header, row cell and ReadyLaunch print button added by the PDF Invoice add-on.
mepr_remove_class_action('mepr_account_payments_table_header', 'MePdfInvoicesCtrl', 'table_header');
mepr_remove_class_action('mepr_account_payments_table_row', 'MePdfInvoicesCtrl', 'table_row');
mepr_remove_class_action('mepr_readylaunch_thank_you_page_after_invoice', 'MePdfInvoicesCtrl', 'render_print_button_readylaunch');
// Add our own header (same label).
add_action('mepr_account_payments_table_header', function () {
echo '<th scope="col">' . esc_html_x('Download', 'ui', 'memberpress-pdf-invoice') . '</th>';
}, 10);
// Add our own row cell: show PDF link for eligible gateways; show dash for Offline/Manual.
add_action('mepr_account_payments_table_row', function ($payment) {
if (!($payment instanceof MeprTransaction)) {
$payment = new MeprTransaction((int) $payment->id);
}
$show_link = !mepr_should_disable_pdf_for_txn($payment);
echo '<td data-label="' . esc_attr_x('Download', 'ui', 'memberpress-pdf-invoice') . '">';
if ($show_link) {
$url = MeprUtils::admin_url(
'admin-ajax.php',
array('download_invoice', 'mepr_invoices_nonce'),
array('action' => 'mepr_download_invoice', 'txn' => $payment->id)
);
echo '<a href="' . esc_url($url) . '" target="_blank">' . esc_html_x('PDF', 'ui', 'memberpress-pdf-invoice') . '</a>';
} else {
echo '—';
}
echo '</td>';
}, 10);
}, 1000);
// 4) Remove admin row "PDF Invoice / Proforma Invoice" link for Offline/Manual transactions.
add_filter('mepr_admin_txn_row_action_links', function ($links, $rec, $txn) {
if (!($txn instanceof MeprTransaction)) { return $links; }
if (mepr_should_disable_pdf_for_txn($txn)) {
// The add-on uses array key 'download_invoice' for both PDF and Proforma PDF links.
unset($links['download_invoice']);
}
return $links;
}, 20, 3);
After adding the code, clear any active caching plugins and test using a transaction processed through the Offline Gateway.
2) Targeting a Different Gateway
The default snippet targets the Offline and Manual gateways. To disable PDF invoices for a different gateway, modify the logic inside the mepr_should_disable_pdf_for_txn() function.
How to Test/Fix:
Replace or add the relevant gateway key check. For example, to target Stripe instead of the Offline gateway:
// Replace 'offline' with the desired gateway key, e.g. 'stripe' for Stripe.
if ($pm_key === 'stripe') { return true; }
Each gateway has a specific key identifier. To confirm the correct key for a given gateway, inspect the transaction object or check the gateway’s class definition in the MemberPress source files.
3) PDF Still Appears After Adding the Code
If the PDF download link or email attachment still appears after adding the snippet, the changes may not be taking effect due to caching or a code conflict.
How to Test/Fix:
- Confirm the snippet is active and has no PHP syntax errors by checking Dashboard > Tools > Site Health > Info or reviewing any fatal error logs.
- Clear all server-side and plugin-level caches.
- Test in a private/incognito browser window to rule out browser caching.
- Confirm the transaction being tested was processed through the Offline or Manual gateway by navigating to Dashboard > MemberPress > Transactions and checking the Gateway column.
- If using a code snippet plugin, ensure the snippet is set to run on All Pages (front-end and back-end).
Public Facing Documentation / Additional References
Public Facing Documentation
- MemberPress PDF Invoice Add-On
- MemberPress Offline Gateway Documentation
- How to Set Up Popular Caching Plugins with MemberPress
- Certified MemberPress Partners
Developer Documentation
- Using a Child Theme in WordPress (WordPress Developer Docs)
- Code Snippets Plugin (WordPress.org)
- WPCode Plugin (WordPress.org)
- How to Find and Access WordPress Error Logs (WPBeginner)

