Home / Admin / Change the Payment Delimiter Inside Email Notifications
Duplicate Snippet

Embed Snippet on Your Site

Change the Payment Delimiter Inside Email Notifications

This snippet changes the default separator for payment details in emails.

<10
Code Preview
php
<?php
/**
 * Change the payment delimiter in the email notification
 *
 * @link https://wpforms.com/developers/how-to-change-the-payment-delimiter-inside-email-notifications/
 */
function wpf_dev_entry_email_data( $fields, $entry, $form_data ) {
    // Only run on my form with ID = 310
    if ( absint( $form_data[ 'id' ] ) !== 310 ) {
        return $fields;
    }
    foreach ( $fields as $field_id => $field ) {
        if ( empty( $field[ 'value_choice' ] ) ) {
            continue;
        }
        // Default is a dash (-), change here to what you need
        $delimiter = ' : ';
        $fields[ $field_id ][ 'value' ] = $field[ 'value_choice' ] . 
            $delimiter . wpforms_format_amount( $field[ 'amount_raw' ], true );
    }
    return $fields;
}
add_filter( 'wpforms_entry_email_data', 'wpf_dev_entry_email_data', 10, 3 );

Comments

Add a Comment