### [How to Hide the Item Price Value in the Email Notifications](https://wpforms.com/developers/how-to-hide-the-item-price-value-in-the-email-notifications/)

**Published:** March 23, 2021
**Author:** Editorial Team

**Excerpt:** This tutorial will show you how to implement a script that will hide the item price from all email notifications. 

**Content:**

## Introduction

Would you like to hide the **Item Price** from the email notifications? You may need to hide either the total or just the item price or even another field from your email notifications. Using a small PHP snippet you can easily exclude the price from the notification.

## Creating the form

To begin, we’ll create a payment form with **Payment Fields**. If you need assistance with this, [please check out this documentation](https://wpforms.com/docs/how-to-create-a-payment-form-in-wpforms/ "Creating a Payment Form").

![create a payment form and add your payment fields](https://wpforms.com/wp-content/uploads/2022/08/wpforms-payment-form.jpg)

## Adding the snippet

Now it’s time to add the snippet to your site.

If you need help with where and how to add snippets to your site, [please check out this tutorial](https://wpforms.com/developers/how-to-add-custom-php-or-javascript-for-wpforms/ "How to Add Custom PHP or JavaScript for WPForms").

```

/*
 * Hide the price from notifications
 *
 * @link https://wpforms.com/developers/how-to-hide-the-item-price-value-in-the-email-notifications
 */

function wpf_email_field_value( $value, $field, $form_data, $context) {
    
    if ( 'email-html' === $context ) {
	
        // If the form ID is 364 AND the field ID is 19 remove the value from the email notification	
        if ( 364 == $form_data[ 'id' ] && 19 == $field[ 'id' ] ) {

            return $field[ 'value' ] = '';

        }
    }

    return $value;
}
add_filter( 'wpforms_html_field_value', 'wpf_email_field_value', 15, 4 );
```

You’ll need to update the code above so that it matches the correct form ID **(364)** and the correct field id **(19)**. If you need assistance with finding the form or field ID, [please review this documentation](https://wpforms.com/developers/how-to-locate-form-id-and-field-id/ "How to Locate Form ID and Field ID").

![using this snippet you can hide the item price from email notifications](https://wpforms.com/wp-content/uploads/2022/08/wpforms-hide-item-price.jpg)

And that’s all you need! Would you like to customize the email template header when sending your emails? Take a look at our article on [How to Customize the Styles on the Email Template](https://wpforms.com/developers/how-to-customize-the-styles-on-the-email-template/ "How to Customize the Styles on the Email Template").

## Related

Filter Reference: [wpforms\_html\_field\_value](https://wpforms.com/developers/wpforms_html_field_value/ "Using the wpforms_html_field_value filter")

## FAQ

#### Q: Can you use this to hide a Hidden Field from the email notification?

**A:** Absolutely! You would just change the **19 == $field\[‘id’\]** to match the ID of the **Hidden Field**.

#### Q: Can I hide multiple fields with this?

**A:** Of course! So to hide more than one field, you would just need to use a PHP or statement. The **or** statement is just two pipelines in your code. See the example below.

```

/*
 * Hide the price from notifications
 *
 * @link https://wpforms.com/developers/how-to-hide-the-item-price-value-in-the-email-notifications
 */

function wpf_email_field_value( $value, $field, $form_data, $context) {
    
    // If you are sending HTML emails run this snippet
    if ( 'email-html' === $context ) {

        // And if the form ID is 364 AND the field ID is 19 OR the form ID is 364 AND the field ID is 18
        // remove the value from the email notification	 		
        if ( 364 == $form_data[ 'id' ] && 19 == $field[ 'id' ] || 364 == $form_data[ 'id' ] && 18 == $field[ 'id' ]) {

            return $field['value'] = '';

        }
    }

    return $value;
}
add_filter( 'wpforms_html_field_value', 'wpf_email_field_value', 15, 4 );
```

You can also do the same with the or statement and group multiple form IDs as well as multiple field IDs.

**Categories:** Tutorials

**Tags:** PHP

---

