Skip to content

Instantly share code, notes, and snippets.

@xlplugins
Last active September 13, 2023 08:08
Show Gist options
  • Save xlplugins/5e57c84962d23e2edf24b0c35ca8a9bb to your computer and use it in GitHub Desktop.
Save xlplugins/5e57c84962d23e2edf24b0c35ca8a9bb to your computer and use it in GitHub Desktop.
php field validation on checkout page
add_filter( 'wfacp_checkout_fields', 'ocultar_validar_cuit_cuilde_ar', 20 );
function ocultar_validar_cuit_cuilde_ar( $fields ) {
// Verificar si el país seleccionado es Argentina (código de país: AR)
if ( isset( $_POST['billing_country'] ) && $_POST['billing_country'] !== 'AR' ) {
// Deshabilitar la validación del campo 'billing_cuitcuil'
$fields['advanced']['billing_cuitcuil']['required'] = false;
}
return $fields;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment