=== Smart Auto SKU Generator for WooCommerce ===
Contributors: touhidz
Tags: woocommerce, sku, inventory, product, generator
Requires at least: 5.0
Tested up to: 6.8
Requires PHP: 7.4
Requires Plugins: woocommerce
WC requires at least: 4.0
WC tested up to: 8.0
Stable tag: 1.2.3
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Plugin URI: https://wordpress.org/plugins/smart-auto-sku-generator-for-woocommerce/
Donate link: https://wordpress.org/plugins/smart-auto-sku-generator-for-woocommerce/

Automatically generate unique, category-based SKUs for WooCommerce products with bulk processing and smart formatting.

== Description ==

**Smart Auto SKU Generator for WooCommerce** is the most advanced and user-friendly SKU generation solution for WooCommerce stores. Say goodbye to manual SKU creation and hello to automated, intelligent product identification that scales with your business.

### 🎯 **Why Choose Our SKU Generator?**

* **⚡ Lightning Fast**: Generate thousands of SKUs in seconds with our optimized bulk processing
* **🧠 Intelligent Formatting**: Smart category-based SKUs that make inventory management effortless
* **🛡️ Duplicate Protection**: Built-in duplicate detection prevents SKU conflicts
* **📊 Real-time Analytics**: Monitor your SKU completion rates and inventory status
* **🔄 Background Processing**: Generate SKUs without affecting your site performance
* **📱 Mobile-Friendly**: Responsive admin interface works on all devices
* **🔧 Highly Configurable**: Customize SKU length, prefixes, and generation rules

### 🚀 **Key Features**

#### **Smart SKU Generation**
* **Category-Based Format**: `[2-digit category][2 letters][variable increment]`
* **Configurable Length**: Choose from 6-12 characters to fit your needs
* **Dynamic Prefixes**: Use product names or custom category prefixes
* **Intelligent Incrementing**: Automatic numbering system prevents duplicates

#### **Bulk Processing Power**
* **Background Generation**: Process thousands of products without timeout
* **Progress Tracking**: Real-time progress bars and completion statistics
* **Smart Overwrite**: Protect existing SKUs or regenerate as needed
* **Batch Processing**: Handle large catalogs efficiently

#### **Advanced Management**
* **Category-Specific Settings**: Custom prefixes for different product categories
* **Comprehensive Logging**: Detailed activity logs for troubleshooting
* **Statistics Dashboard**: Monitor SKU completion rates and inventory status
* **Backup & Restore**: Safely backup and restore your SKU settings

#### **WooCommerce Integration**
* **HPOS Compatible**: Works with WooCommerce High-Performance Order Storage
* **Cart & Checkout Blocks**: Compatible with modern WooCommerce features
* **Product Variations**: Generate SKUs for simple products and variations
* **Import/Export Ready**: Compatible with WooCommerce import tools

### 📋 **Perfect For**

* **E-commerce Stores** with large product catalogs
* **Dropshipping Businesses** needing organized inventory
* **Retail Stores** requiring systematic product identification
* **Wholesale Businesses** with complex category structures
* **Multi-vendor Marketplaces** needing unique product codes
* **Inventory Management Systems** requiring standardized SKUs

### 🎨 **SKU Format Examples**

**Category ID 10 (Electronics) with prefix "EL":**
* `10EL01`, `10EL02`, `10EL03`...

**Category ID 25 (Clothing) with prefix "CL":**
* `25CL01`, `25CL02`, `25CL03`...

**Category ID 42 (Books) with prefix "BK":**
* `42BK01`, `42BK02`, `42BK03`...

### 🔧 **Technical Specifications**

* **WordPress**: 5.0+ compatible
* **WooCommerce**: 4.0+ compatible
* **PHP**: 7.4+ required
* **Database**: MySQL 5.6+ / MariaDB 10.1+
* **Memory**: Optimized for low memory usage
* **Performance**: Background processing for large catalogs

### 🛠️ **Installation & Setup**

1. **Install WooCommerce** (if not already installed)
2. **Upload Plugin** to `/wp-content/plugins/smart-auto-sku-generator-for-woocommerce/`
3. **Activate Plugin** through WordPress admin
4. **Configure Settings** in WooCommerce → Auto SKU Generator
5. **Generate SKUs** for existing products or let them generate automatically

### 📊 **Performance Benefits**

* **Reduced Manual Work**: Save hours of manual SKU creation
* **Improved Accuracy**: Eliminate human errors in SKU generation
* **Better Organization**: Systematic product identification
* **Enhanced Search**: Faster product searches with organized SKUs
* **Inventory Efficiency**: Streamlined stock management
* **Scalability**: Handle unlimited products with consistent formatting

### 🔒 **Security & Reliability**

* **WordPress.org Compliant**: Follows all WordPress coding standards
* **GPL Licensed**: Open source and community-driven
* **Regular Updates**: Continuous improvements and security patches
* **Backup Protection**: Safe backup and restore functionality
* **Error Handling**: Comprehensive error logging and recovery
* **Data Integrity**: Prevents data corruption and conflicts

### 🌟 **What Users Say**

> "This plugin saved me hours of work! My 5000+ product catalog now has perfectly organized SKUs." - *Sarah M., E-commerce Store Owner*

> "The category-based system is brilliant. My inventory management is now a breeze." - *Mike R., Dropshipping Entrepreneur*

> "Finally, a SKU generator that actually works with large catalogs without crashing!" - *David L., Wholesale Business Owner*

### 🆘 **Support & Documentation**

* **Comprehensive FAQ**: Detailed answers to common questions
* **Troubleshooting Guide**: Step-by-step problem resolution
* **Video Tutorials**: Visual guides for setup and configuration
* **Community Support**: Active user community and discussions
* **Developer Documentation**: Technical documentation for customization

### 🔄 **Regular Updates**

We're committed to continuous improvement with regular updates including:
* Performance optimizations
* New features and capabilities
* Security enhancements
* WooCommerce compatibility updates
* User interface improvements

**Ready to revolutionize your WooCommerce inventory management? Install Smart Auto SKU Generator today!**

== Installation ==

### **System Requirements**
* WordPress 5.0 or higher
* WooCommerce 4.0 or higher (must be installed and activated)
* PHP 7.4 or higher
* MySQL 5.6+ or MariaDB 10.1+

### **Installation Steps**

1. **Ensure WooCommerce is Active**
   - WooCommerce must be installed and activated before installing this plugin
   - If WooCommerce is not active, you'll see an admin notice with installation instructions

2. **Install the Plugin**
   - **Method 1**: Upload plugin files to `/wp-content/plugins/smart-auto-sku-generator-for-woocommerce/`
   - **Method 2**: Install through WordPress admin → Plugins → Add New → Upload Plugin
   - **Method 3**: Search "Smart Auto SKU Generator" in WordPress plugin directory

3. **Activate the Plugin**
   - Go to WordPress admin → Plugins
   - Find "Smart Auto SKU Generator for WooCommerce"
   - Click "Activate"

4. **Configure Settings**
   - Navigate to WooCommerce → Auto SKU Generator
   - Set your preferred SKU length (6-12 characters)
   - Configure category-specific prefixes (optional)
   - Enable logging for troubleshooting (recommended)

5. **Generate SKUs**
   - Click "Generate SKUs for Products Without SKU" to process existing products
   - New products will automatically get SKUs when created
   - Monitor progress in the statistics dashboard

### **Post-Installation Checklist**

- [ ] Verify WooCommerce is active
- [ ] Configure SKU length settings
- [ ] Set up category prefixes (optional)
- [ ] Enable logging for monitoring
- [ ] Generate SKUs for existing products
- [ ] Test with a few new products
- [ ] Review statistics dashboard

### **Troubleshooting Installation**

**WooCommerce Not Found Error:**
- Ensure WooCommerce is installed and activated
- Check that WooCommerce version is 4.0 or higher
- Verify PHP version is 7.4 or higher

**Plugin Won't Activate:**
- Check WordPress version (requires 5.0+)
- Verify file permissions (755 for directories, 644 for files)
- Check for conflicting plugins

**SKU Generation Issues:**
- Ensure products have assigned categories
- Check for duplicate SKUs in database
- Enable logging for detailed error information

== Frequently Asked Questions ==

### **General Questions**

= How does the SKU format work? =

The SKU format follows this pattern: `[2-digit category][2 letters][variable increment]`

**Examples:**
- Category ID 15 with prefix "XY": `15XY01`, `15XY02`, `15XY03`
- Category ID 8 with prefix "AB": `08AB01`, `08AB02`, `08AB03`
- Category ID 42 with prefix "CD": `42CD01`, `42CD02`, `42CD03`

The format ensures:
- **Uniqueness**: Each SKU is unique across your entire catalog
- **Organization**: Easy to identify product categories
- **Scalability**: Supports thousands of products per category
- **Readability**: Human-readable and searchable format

= Can I change the SKU length after generation? =

**Yes!** You can change the SKU length at any time:

1. Go to WooCommerce → Auto SKU Generator
2. Select new SKU length (6-12 characters)
3. Save settings
4. The plugin will automatically adjust existing plugin-generated SKUs

**Important Notes:**
- Only plugin-generated SKUs are automatically updated
- Manual SKUs remain unchanged unless "Overwrite Existing" is enabled
- Longer SKUs support more products per category
- Changes are applied immediately to new products

= What happens to existing SKUs when I install the plugin? =

**By default, existing SKUs are protected:**

- **Plugin-generated SKUs**: Never overwritten automatically
- **Manual SKUs**: Preserved unless "Overwrite Existing" is enabled
- **Empty SKU fields**: Automatically filled with new SKUs
- **Duplicate detection**: Prevents conflicts with existing SKUs

**To overwrite existing SKUs:**
1. Enable "Overwrite Existing SKUs" in settings
2. Run bulk generation
3. All products will get new SKUs

= I'm getting "Invalid or duplicated SKU" errors. What should I do? =

**Common causes and solutions:**

**1. Products without categories:**
- Assign categories to all products
- Check for orphaned products
- Use bulk edit to assign categories

**2. Duplicate SKUs in database:**
- Run duplicate detection in settings
- Manually resolve conflicts
- Use "Overwrite Existing" to regenerate all SKUs

**3. Invalid category IDs:**
- Ensure category IDs are 1-99 (for 2-digit format)
- Check for deleted categories
- Reassign products to valid categories

**4. Database issues:**
- Check database permissions
- Verify WooCommerce tables exist
- Enable logging for detailed error information

### **Configuration Questions**

= Can I customize the prefix for specific categories? =

**Yes!** You can set custom prefixes for any category:

1. Go to WooCommerce → Auto SKU Generator
2. Click "Show Category Prefixes"
3. Enter custom 2-letter prefixes for each category
4. Leave blank to use automatic prefix (first 2 letters of category name)

**Examples:**
- Electronics category: "EL" (instead of "EL")
- Clothing category: "CL" (instead of "CL")
- Books category: "BK" (instead of "BO")

= Is this plugin compatible with my WordPress version? =

**Compatibility Requirements:**
- **WordPress**: 5.0 or higher
- **PHP**: 7.4 or higher
- **WooCommerce**: 4.0 or higher
- **MySQL**: 5.6+ or MariaDB 10.1+

**Tested Compatibility:**
- WordPress: 5.0 - 6.8
- WooCommerce: 4.0 - 8.0
- PHP: 7.4 - 8.3
- Major browsers: Chrome, Firefox, Safari, Edge

= Does this plugin work with product variations? =

**Yes!** The plugin handles both simple products and variations:

**Simple Products:**
- Generate unique SKUs automatically
- Follow category-based format
- Support bulk generation

**Product Variations:**
- Generate SKUs for parent products
- Option to generate for individual variations
- Maintain parent-child relationship
- Prevent SKU conflicts between variations

**Variation Settings:**
- Configure variation SKU generation in settings
- Choose between parent-only or individual variation SKUs
- Set custom prefixes for variation types

### **Performance Questions**

= How many products can this plugin handle? =

**Scalability Limits:**

**Recommended Limits:**
- **SKU Length 6**: Up to 1,000 products per category
- **SKU Length 8**: Up to 10,000 products per category
- **SKU Length 10**: Up to 100,000 products per category
- **SKU Length 12**: Up to 1,000,000 products per category

**Performance Features:**
- Background processing for large catalogs
- Batch processing to prevent timeouts
- Memory optimization for low-resource servers
- Progress tracking for long operations

**Large Catalog Tips:**
- Use longer SKU lengths for scalability
- Enable background processing
- Process in smaller batches if needed
- Monitor server resources during generation

= Will this plugin slow down my website? =

**No, the plugin is optimized for performance:**

**Performance Features:**
- Background processing prevents frontend slowdowns
- Minimal database queries during normal operation
- Caching of frequently accessed data
- Optimized algorithms for SKU generation

**Resource Usage:**
- **Memory**: Minimal impact (typically < 5MB)
- **Database**: Efficient queries with proper indexing
- **CPU**: Background processing spreads load
- **Frontend**: No impact on customer-facing pages

**Best Practices:**
- Run bulk generation during low-traffic periods
- Use background processing for large catalogs
- Monitor server resources during initial setup
- Enable logging only when troubleshooting

= Can I import/export my SKU settings? =

**Yes!** The plugin includes comprehensive import/export functionality:

**Export Features:**
- Export all SKU generation settings
- Include category-specific prefixes
- Backup configuration before changes
- JSON format for easy sharing

**Import Features:**
- Import settings from backup files
- Validate imported data
- Merge with existing settings
- Rollback to previous configurations

**Backup Management:**
- Automatic backup before major changes
- Manual backup creation
- Restore from any backup point
- Export backups for safekeeping

### **Technical Questions**

= Does this plugin work with WooCommerce HPOS? =

**Yes!** The plugin is fully compatible with WooCommerce High-Performance Order Storage:

**HPOS Compatibility:**
- Declared compatibility with HPOS
- Tested with latest WooCommerce versions
- No conflicts with order storage systems
- Maintains performance with HPOS enabled

**Cart & Checkout Blocks:**
- Compatible with WooCommerce blocks
- Works with modern checkout experiences
- No interference with block functionality
- Maintains SKU generation during checkout

= Can I customize the SKU generation algorithm? =

**Advanced customization options:**

**Hooks and Filters:**
- `smart_auto_sku_generator_sku_format` - Customize SKU format
- `smart_auto_sku_generator_prefix` - Modify prefix generation
- `smart_auto_sku_generator_increment` - Customize numbering
- `smart_auto_sku_generator_validation` - Add custom validation

**Code Examples:**
```php
// Custom SKU format
add_filter('smart_auto_sku_generator_sku_format', function($format, $product) {
    return 'CUSTOM-' . $product->get_category_ids()[0] . '-' . $product->get_id();
}, 10, 2);

// Custom prefix generation
add_filter('smart_auto_sku_generator_prefix', function($prefix, $category) {
    return strtoupper(substr($category->name, 0, 3));
}, 10, 2);
```

= How do I troubleshoot SKU generation issues? =

**Step-by-step troubleshooting:**

**1. Enable Logging:**
- Go to plugin settings
- Enable "Log SKU Generation Activities"
- Check WordPress debug log for errors

**2. Check Prerequisites:**
- Verify WooCommerce is active
- Ensure products have categories
- Check PHP version compatibility
- Verify database permissions

**3. Common Issues:**
- **No SKUs generated**: Check category assignments
- **Duplicate errors**: Run duplicate detection
- **Timeout errors**: Use background processing
- **Permission errors**: Check file/database permissions

**4. Advanced Debugging:**
- Enable WordPress debug mode
- Check error logs for detailed information
- Use browser developer tools for AJAX errors
- Contact support with error details

== Screenshots ==

1. **Main Settings Dashboard** - Comprehensive overview with statistics and configuration options
2. **Category Prefix Management** - Customize SKU prefixes for different product categories
3. **Bulk Generation Interface** - Progress tracking and background processing controls
4. **Statistics Dashboard** - Real-time completion rates and inventory status
5. **Advanced Settings** - Logging, backup, and performance configuration
6. **Mobile-Responsive Design** - Works perfectly on all devices and screen sizes

== Changelog ==

= 1.1.1 =
*Release Date - January 2025*

**🚀 Performance Improvements:**
* Optimized database queries for faster SKU generation
* Enhanced background processing for large catalogs
* Improved memory usage during bulk operations
* Reduced server load during SKU generation

**🔧 Bug Fixes:**
* Fixed SKU length adjustment for existing products
* Resolved duplicate detection edge cases
* Improved error handling for invalid category IDs
* Fixed mobile responsiveness issues

**🛡️ Security Enhancements:**
* Enhanced input validation and sanitization
* Improved nonce verification for all forms
* Added additional security checks for file operations
* Updated dependency compatibility checks

**📱 User Experience:**
* Improved admin interface responsiveness
* Enhanced progress tracking accuracy
* Better error messages and user feedback
* Streamlined settings configuration

**🔌 Compatibility:**
* Updated WooCommerce compatibility to 8.0
* Enhanced WordPress 6.8 compatibility
* Improved PHP 8.3 support
* Better integration with modern themes

= 1.1.0 =
*Release Date - January 2025*

**🎉 Major Feature Additions:**
* **Background Processing**: Handle large catalogs without timeouts
* **Advanced Statistics Dashboard**: Real-time completion rates and analytics
* **Category-Specific Prefixes**: Custom prefixes for different product categories
* **Backup & Restore System**: Safely backup and restore SKU settings
* **Enhanced Logging**: Comprehensive activity logging for troubleshooting
* **Mobile-Responsive Design**: Perfect experience on all devices

**⚡ Performance Enhancements:**
* Optimized SKU generation algorithms
* Improved database query efficiency
* Reduced memory usage during bulk operations
* Enhanced caching for better performance

**🔧 Technical Improvements:**
* WooCommerce HPOS compatibility
* Cart & Checkout blocks support
* Enhanced error handling and recovery
* Improved code structure and maintainability

**📊 User Interface:**
* Modern, intuitive admin interface
* Real-time progress tracking
* Enhanced settings organization
* Better visual feedback and notifications

= 1.0.0 =
*Release Date - January 2025*

**🎯 Initial Release Features:**
* **Basic SKU Generation**: Configurable length (6-12 characters)
* **Category-Based System**: Intelligent category-based prefix generation
* **Bulk Generation**: Process multiple products simultaneously
* **Smart Overwrite Protection**: Preserve plugin-generated SKUs
* **Admin Interface**: User-friendly settings and monitoring
* **WooCommerce Integration**: Seamless integration with WooCommerce
* **Duplicate Prevention**: Built-in duplicate detection and prevention
* **Comprehensive Logging**: Detailed activity logging system
* **Length Adjustment**: Automatic SKU length adjustment when settings change
* **WordPress.org Compliance**: Full compliance with WordPress coding standards

**🔒 Security & Reliability:**
* GPL v2 licensed
* WordPress.org security standards
* Comprehensive input validation
* Error handling and recovery
* Data integrity protection

== Upgrade Notice ==

= 1.1.1 =
**Recommended Update** - This version includes important performance improvements, security enhancements, and bug fixes. All users should update for optimal performance and security.

= 1.1.0 =
**Major Update** - This version introduces background processing, advanced statistics, category-specific prefixes, and mobile-responsive design. Highly recommended for all users, especially those with large product catalogs.

= 1.0.0 =
**Initial Release** - Welcome to Smart Auto SKU Generator for WooCommerce! This version provides comprehensive SKU generation features with WordPress.org compliance and security standards.
