Skip to content

Instantly share code, notes, and snippets.

@woogists
Last active March 12, 2018 13:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save woogists/52cccaf4c70620e6013a9bc0fceeeae2 to your computer and use it in GitHub Desktop.
Save woogists/52cccaf4c70620e6013a9bc0fceeeae2 to your computer and use it in GitHub Desktop.
[Extending][Implementing the WC Integration Class] Validation
public function validate_api_key_field( $key, $value ) {
if ( isset( $value ) && 20 < strlen( $value ) ) {
WC_Admin_Settings::add_error( esc_html__( 'Looks like you made a mistake with the API Key field. Make sure it isn&apos;t longer than 20 characters', 'woocommerce-integration-demo' ) );
}
return $value;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment