Requiring a Cardholder Name

Requiring a Cardholder Name

As some payment add-ons such as the Authorize.Net add-on do not require the cardholder name to be validated, it is not typically required within the credit card field. This snippet will allow you to require the cardholder』s name.
12345678add_filter( 'gform_field_validation', function ( $result, $value, $form, $field ) {    if ( $field->type == 'creditcard' && $result['is_valid'] && rgempty( $field->id . '.5', $value ) ) {        $result['is_valid'] = false;        $result['message']  = 'Please enter the cardholder first and last name.';    }     return $result;}, 10, 4 );

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注