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 );

發表回覆

您的電子郵箱地址不會被公開。 必填項已用 * 標註