DNIWOO - DNI/NIF for WooCommerce WP Registry grade A. No security issues foundWP RegistryNo security issues foundOpen the reportA
Añade DNI/NIE/CIF/NIF/NIPC para españa y portugal a Woocommerce
Install
Upload it under Plugins → Add New Plugin → Upload Plugin, then activate.
Install straight from GitHub with WP-CLI:
wp plugin install https://github.com/replantadev/dniwoo/releases/download/v1.2.3/dniwoo-v1.2.3.zipProfessional DNI/NIF field for WooCommerce checkout with validation for Spain and Portugal.
Features
- 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
Installation
IMPORTANT: Download from Releases, not the "Code" button.
Method 1: WordPress Admin (Recommended)
- 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
Method 2: Manual Installation
- Download from Releases
- Extract the ZIP file
- Upload the
dniwoofolder to/wp-content/plugins/ - Activate in WordPress admin
⚠️ Do NOT download from "Code" button
This creates folder naming issues. Always use the Releases section.
Requirements
- WordPress 5.0 or higher
- WooCommerce 7.0 or higher
- PHP 7.4 or higher
Configuration
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
Supported Documents
Spain
- 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
Portugal
- NIF (Número de Identificação Fiscal) - 9 digits
- NIPC (Número de Identificação de Pessoa Coletiva) - 9 digits
Field Validation
Client-side (JavaScript)
- Format validation while typing
- Real-time AJAX validation (optional)
- Immediate user feedback
- Prevents form submission with invalid data
Server-side (PHP)
- Complete validation algorithms
- Double-check on form submission
- Security against tampering
Theme Compatibility
DNIWOO is designed to work with all WordPress themes:
- Astra
- Storefront
- GeneratePress
- OceanWP
- Divi
- Avada
- And many more
Styling
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
Hooks & Filters
Actions
// 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');
Filters
// 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);
JavaScript API
// 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'));
REST API
Validate Document
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"
}
Troubleshooting
Plugin not working?
- 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
Field not showing?
- 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
Validation not working?
- 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
Development
Local Development
# Clone repository
git clone https://github.com/replantadev/dniwoo.git
# Install dependencies (if any)
cd dniwoo
composer install --dev
# Run tests
composer test
Coding Standards
This plugin follows WordPress coding standards:
# Check coding standards
composer phpcs
# Fix coding standards
composer phpcbf
Security
Validation Security
- All inputs are sanitized
- Server-side validation as final check
- CSRF protection with nonces
- XSS prevention with proper escaping
Data Privacy
- No personal data stored by default
- GDPR compliant
- No external API calls for validation
- Local validation algorithms
Performance
- Lightweight - Minimal footprint
- Conditional loading - Assets only on checkout
- Optimized CSS - Minimal styles, theme-adaptive
- Efficient JS - ES5 compatible, no dependencies
Changelog
1.1.0 (2026-02-28)
- 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
1.0.7 (2026-02-03)
- Fixed Portugal validation country code case sensitivity
- Fixed JavaScript error with Portugal messages
1.0.0 (2024-01-XX)
- Initial release
- Spain and Portugal support
- Real-time validation
- Professional WordPress standards
- Auto-update system
- Complete documentation
Support
- GitHub Issues: Report bugs
- Documentation: Wiki
- Email: info@replanta.dev
- Website: https://replanta.net
License
GPL v3 or later - License
Credits
Developed by Replanta - Sustainable WordPress solutions.
Releases
12 releases. Each count is every asset in that release; expand a row for the breakdown.