Skip to content

lueroux/clw-eori-fields

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CLW EORI Fields

A WordPress plugin that integrates with CheckoutWC to add EORI number requirements for Northern Ireland addresses under the Windsor Framework.

Features

Core Functionality

  • 🏴󠁧󠁢󠁮󠁩󠁲󠁿 Northern Ireland Detection: Automatically detects NI addresses by postcode (BT) and county
  • 👥 Customer Type Selection: Consumer vs Business classification
  • 🔢 EORI Number Collection: Required for business customers shipping to Northern Ireland
  • Real-time Validation: Validates EORI format with intelligent suggestions
  • 🔧 Auto-correction: Attempts to fix common EORI format mistakes

Integration

  • 🛒 CheckoutWC Primary: Full integration with CheckoutWC checkout flow
  • 🔄 Standard WooCommerce Fallback: Works with default WooCommerce checkout
  • 📱 Mobile Responsive: Modern, sleek UI optimized for all devices
  • 🌙 Dark Mode Support: Adapts to user's color scheme preferences

Admin Features

  • 📋 Order Management: EORI information displayed in order details
  • 📧 Email Integration: EORI data included in order emails
  • 🔍 Validation Tools: Admin tools to revalidate and fix EORI numbers

Data Management

  • 💾 Order Storage: EORI data saved with order metadata
  • 👤 Customer Profiles: EORI information saved to customer accounts
  • 🔒 Validation Tracking: Tracks validation status and suggestions
  • 📝 Audit Trail: Complete history of EORI validation attempts

Installation

  1. Upload the Plugin

    # Via WordPress admin
    Plugins → Add New → Upload Plugin → Choose clw-eori-fields.zip
    
    # Via FTP
    Upload the entire /clw-eori-fields/ directory to /wp-content/plugins/
  2. Activate the Plugin

    Plugins → Installed Plugins → CLW EORI Fields → Activate
  3. Requirements Check

    • ✅ WordPress 5.0+
    • ✅ WooCommerce 5.0+
    • ✅ PHP 7.4+
    • 🎯 CheckoutWC (recommended but optional)

Usage

For Customers

  1. Address Detection

    • Enter a Northern Ireland address (BT postcode or NI county)
    • EORI section appears automatically
  2. Customer Type Selection

    • Choose "Consumer" or "Business"
    • Business selection reveals EORI field
  3. EORI Entry

    • Enter EORI number (e.g., GB123456789012)
    • Real-time validation provides feedback
    • Suggestions offered for invalid formats

For Store Administrators

  1. View EORI Data

    WooCommerce → Orders → [Order] → Northern Ireland Trade Information
    
  2. Revalidate EORI

    • Click "Revalidate" button in order details
    • Apply suggested corrections with one click

Windsor Framework Compliance

This plugin helps ensure compliance with Windsor Framework requirements by:

  • 📋 Collecting necessary trade classification data
  • 🔍 Validating EORI number formats
  • 📊 Providing audit trails for customs purposes
  • 📄 Including data in order documentation

Official Resources:

Configuration

Address Detection Settings

The plugin automatically detects Northern Ireland addresses using:

// Postcode detection (BT postcodes)
BT1, BT2, BT3... BT94

// County/State detection
'Antrim', 'Armagh', 'Down', 'Fermanagh', 'Londonderry', 'Tyrone', 'Northern Ireland'

EORI Validation

Supports EORI formats for all EU countries:

// Examples
GB123456789012  // Great Britain
XI123456789012  // Northern Ireland
IE1234567A      // Ireland
DE123456789     // Germany
// ... and more

Hooks and Filters

Actions

// Before EORI section render
do_action('clw_eori_before_section', $context, $checkout);

// After EORI validation
do_action('clw_eori_after_validation', $order_id, $validation_result);

// When customer type changes
do_action('clw_eori_customer_type_changed', $customer_type, $order_id);

Filters

// Customize Northern Ireland detection
add_filter('clw_eori_is_northern_ireland', function($is_ni, $postcode, $country, $state) {
    // Custom logic
    return $is_ni;
}, 10, 4);

// Modify EORI validation result
add_filter('clw_eori_validation_result', function($result, $eori_number) {
    // Custom validation
    return $result;
}, 10, 2);

// Customize section visibility
add_filter('clw_eori_show_section', function($show, $postcode, $country, $state) {
    // Custom visibility logic
    return $show;
}, 10, 4);

Styling Customization

CSS Variables

:root {
    --clw-eori-primary: #2271b1;
    --clw-eori-secondary: #135e96;
    --clw-eori-success: #00a32a;
    --clw-eori-warning: #d63638;
    --clw-eori-border-radius: 8px;
}

Custom Styles

/* Override section background */
.clw-eori-section {
    background: your-custom-gradient;
    border: 2px solid your-brand-color;
}

/* Customize radio buttons */
.clw-eori-radio-label {
    background: your-button-background;
    border-color: your-button-border;
}

Troubleshooting

Common Issues

  1. EORI Section Not Appearing

    // Check if address triggers detection
    $is_ni = CLW_EORI_Checkout::is_northern_ireland_address($postcode, $country, $state);
  2. CheckoutWC Integration Issues

    // Verify CheckoutWC is active
    $is_active = function_exists('cfw_get_checkout_url');
  3. Validation Not Working

    // Check AJAX endpoints
    wp_ajax_clw_validate_eori
    wp_ajax_nopriv_clw_validate_eori

Debug Mode

// Enable debug logging
define('CLW_EORI_DEBUG', true);

// Check logs
WooCommerce → Status → Logs → clw-eori-fields

Performance

Optimization Features

  • ⚡ Lightweight JavaScript (< 5KB gzipped)
  • 🎯 Conditional loading (checkout pages only)
  • 💾 Session-based caching
  • 🔄 Efficient AJAX validation
  • 📱 Mobile-optimized animations

Caching Compatibility

  • ✅ WP Rocket
  • ✅ W3 Total Cache
  • ✅ WP Super Cache
  • ✅ Cloudflare
  • ✅ Autoptimize

Security

Data Protection

  • 🔒 CSRF protection on all AJAX requests
  • 🛡️ Input sanitization and validation
  • 👥 Capability checks for admin functions
  • 🗃️ Secure data storage practices

Privacy Compliance

  • 📝 GDPR compliant data collection
  • 🔄 Data retention policies
  • 👤 Customer data access controls
  • 🗑️ Data deletion capabilities

Changelog

Version 1.0.0

  • 🎉 Initial release
  • ✨ CheckoutWC integration
  • 🔧 EORI validation system
  • 📊 Admin reporting dashboard
  • 📱 Mobile responsive design
  • 🌙 Dark mode support

Support

Documentation

Community

License

GPL v2 or later - see LICENSE file for details.

Credits

Author: Charli Lue Wickes
GitHub: https://github.com/lueroux
Plugin URI: https://github.com/lueroux/clw-eori-fields


Built with ❤️ for WordPress and WooCommerce

About

A Woocommerce plugin to add EORI number requirements for Northern Ireland addresses under the Windsor Framework.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors