# Require the Last Name at EDD Checkout

> Makes the last name field required on the Easy Digital Downloads checkout, for invoices and licences that need a full name.

- Type: PHP
- Runs: Run everywhere
- Category: [Easy Digital Downloads](https://wpide.com/library/category/edd/)
- Requires: Easy Digital Downloads
- Tags: edd, checkout, fields, validation
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/edd-require-last-name/

## Code

```php
add_filter( 'edd_purchase_form_required_fields', function ( $fields ) {
    $fields['edd_last'] = array(
        'error_id'      => 'invalid_last_name',
        'error_message' => 'Please enter your last name.',
    );

    return $fields;
} );
```

## Notes

The field is already on the form; this only makes it mandatory.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Require the Last Name at EDD Checkout" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
