Filter
rpress_receipt_attachments
On this page
Filters the list of file attachments sent with the customer order email.
Runs when the customer receipt is prepared. The default is an empty array. Return absolute file paths to attach to the email, for example a generated invoice. The test receipt passes an order ID of 0 and an empty data array.
Parameters#
| Parameter | Type | Description |
|---|---|---|
$attachments | array | List of file paths to attach. Empty by default. |
$payment_id | int | ID of the order, or 0 for the test receipt. |
$payment_data | array | Order meta from _rpress_payment_meta, or an empty array for the test receipt. |
Return value#
array. The list of attachment file paths.
Example#
function my_receipt_attachments( $attachments, $payment_id, $payment_data ) {
$file = WP_CONTENT_DIR . '/uploads/invoices/order-' . absint( $payment_id ) . '.pdf';
if ( $payment_id && file_exists( $file ) ) {
$attachments[] = $file;
}
return $attachments;
}
add_filter( 'rpress_receipt_attachments', 'my_receipt_attachments', 10, 3 );
Source#
Applied in:
includes/emails/functions.php(line 53), inrpress_email_purchase_receipt()includes/emails/functions.php(line 82), inrpress_email_test_purchase_receipt()
See also#
Was this page helpful?
