Professional DNI/NIF field for WooCommerce checkout with validation for Spain and Portugal.
- Professional validation for Spanish documents (DNI, NIE, CIF)
- Portuguese document support (NIF, NIPC)
- Real-time validation with AJAX
- Client-side validation for instant feedback
- WooCommerce integration - seamless checkout experience
- HPOS compatible - works with WooCommerce High Performance Order Storage
- Theme compatibility - works with all major themes
- Responsive design - mobile-friendly
- Accessibility - WCAG compliant
- Auto-updates via GitHub
- WordPress standards compliant
IMPORTANT: Download from Releases, not the "Code" button.
- Go to GitHub Releases
- Download the latest
dniwoo-vX.X.X.zipfile - In WordPress: Plugins > Add New > Upload Plugin
- Upload the ZIP file and activate
- Download from Releases
- Extract the ZIP file
- Upload the
dniwoofolder to/wp-content/plugins/ - Activate in WordPress admin
This creates folder naming issues. Always use the Releases section.
- WordPress 5.0 or higher
- WooCommerce 7.0 or higher
- PHP 7.4 or higher
Navigate to WooCommerce > Settings > DNIWOO to configure:
- Enable/Disable the DNI field
- Required field - make DNI mandatory
- Validation mode - real-time or on submit
- Error messages - customize validation messages
- Field position - choose where to display the field
- Country detection - automatic field type switching
- DNI (Documento Nacional de Identidad) - 8 digits + letter
- NIE (Número de Identidad de Extranjero) - X/Y/Z + 7 digits + letter
- CIF (Código de Identificación Fiscal) - Letter + 7 digits + control
- NIF (Número de Identificação Fiscal) - 9 digits
- NIPC (Número de Identificação de Pessoa Coletiva) - 9 digits
- Format validation while typing
- Real-time AJAX validation (optional)
- Immediate user feedback
- Prevents form submission with invalid data
- Complete validation algorithms
- Double-check on form submission
- Security against tampering
DNIWOO is designed to work with all WordPress themes:
- Astra
- Storefront
- GeneratePress
- OceanWP
- Divi
- Avada
- And many more
The plugin includes comprehensive CSS that adapts to your theme:
- Responsive design for all devices
- Dark mode support
- High contrast mode support
- RTL (right-to-left) language support
- Print-friendly styles
// Before validation
do_action('dniwoo_before_validation', $document, $country);
// After validation
do_action('dniwoo_after_validation', $document, $country, $is_valid);
// Field output
do_action('dniwoo_before_field');
do_action('dniwoo_after_field');// Modify field settings
$settings = apply_filters('dniwoo_field_settings', $settings);
// Customize validation
$is_valid = apply_filters('dniwoo_validate_document', $is_valid, $document, $country);
// Custom error messages
$message = apply_filters('dniwoo_error_message', $message, $document, $country);
// Field position
$position = apply_filters('dniwoo_field_position', $position);// Get validation status
const isValid = DNIWOOCheckout.isValidDocument('12345678A');
// Validate specific country
const isValidSpain = DNIWOOCheckout.validateSpain('12345678A');
const isValidPortugal = DNIWOOCheckout.validatePortugal('123456789');
// Manual validation trigger
DNIWOOCheckout.validateField($('#billing_dni'));Endpoint: POST /wp-json/dniwoo/v1/validate
Parameters:
document(string) - Document to validatecountry(string) - Country code (ES/PT)
Response:
{
"valid": true,
"message": "Valid document",
"document_type": "DNI",
"formatted": "12345678-A"
}- Check WooCommerce - Ensure WooCommerce is active and updated
- Clear cache - Clear any caching plugins
- Theme conflicts - Test with a default theme
- Plugin conflicts - Deactivate other plugins temporarily
- PHP version - Ensure PHP 7.4 or higher
- Check if the field is enabled in settings
- Verify the field position setting
- Ensure the checkout page is using WooCommerce shortcodes
- Check for theme customizations that might hide fields
- Test with known valid documents:
- Spain:
12345678Z - Portugal:
123456789
- Spain:
- Check browser console for JavaScript errors
- Verify AJAX URL is working
- Test server-side validation independently
# Clone repository
git clone https://github.com/replantadev/dniwoo.git
# Install dependencies (if any)
cd dniwoo
composer install --dev
# Run tests
composer testThis plugin follows WordPress coding standards:
# Check coding standards
composer phpcs
# Fix coding standards
composer phpcbf- All inputs are sanitized
- Server-side validation as final check
- CSRF protection with nonces
- XSS prevention with proper escaping
- No personal data stored by default
- GDPR compliant
- No external API calls for validation
- Local validation algorithms
- Lightweight - Minimal footprint
- Conditional loading - Assets only on checkout
- Optimized CSS - Minimal styles, theme-adaptive
- Efficient JS - ES5 compatible, no dependencies
- Added full HPOS (High Performance Order Storage) compatibility
- Support for WooCommerce custom order tables
- Updated to use WooCommerce Order API
- Minimum WooCommerce version now 7.0
- Tested with WordPress 6.7 and WooCommerce 9.6
- Fixed Portugal validation country code case sensitivity
- Fixed JavaScript error with Portugal messages
- Initial release
- Spain and Portugal support
- Real-time validation
- Professional WordPress standards
- Auto-update system
- Complete documentation
- GitHub Issues: Report bugs
- Documentation: Wiki
- Email: [email protected]
- Website: https://replanta.net
GPL v3 or later - License
Developed by Replanta - Sustainable WordPress solutions.