Brand Product Type Switcher
WordPress plugin for bulk switching WooCommerce product types by brand
by Maxim Shiyan · github.com/avorite/brand-product-type-switcher · website
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/avorite/brand-product-type-switcher/archive/refs/heads/main.zipA powerful WordPress plugin for bulk switching product types (Simple/External) for WooCommerce products organized by brand. Features real-time progress tracking, detailed logging, and preserves Product URL during type switching.
🚀 Features
- Bulk Product Type Switching: Change product types for multiple brands at once
- Brand Selection: Easy checkbox interface to select multiple brands
- Product Type Options:
- Simple (Purchasable)
- External/Affiliate Product
- Progress Tracking: Real-time progress bar with percentage and count
- Detailed Logging: Complete log of all operations with success/error indicators
- Product URL Preservation: Automatically preserves Product URL when switching types
- Batch Processing: Processes products in batches with delays to prevent server overload
- Statistics: Shows success and error counts during processing
- WordPress Codex Compliant: Follows WordPress coding standards and best practices
📋 Requirements
- WordPress 5.0 or higher
- WooCommerce 3.0 or higher
- PHP 7.4 or higher
product_brandtaxonomy (custom taxonomy for products)
📦 Installation
For detailed installation instructions, see INSTALLATION.md.
Quick Installation
Manual Installation:
- Download or clone this repository
- Upload the
brand-product-type-switcherfolder to/wp-content/plugins/directory - Activate the plugin through the 'Plugins' menu in WordPress
- Navigate to WooCommerce → Brand Type Switcher in the admin menu
Via Git:
cd wp-content/plugins
git clone https://github.com/avorite/brand-product-type-switcher.git
🎯 Usage
-
Navigate to Admin Page
- Go to WooCommerce → Brand Type Switcher in your WordPress admin
-
Select Brands
- Check the brands you want to modify
- Use "Select All" to select all brands at once
- Each brand shows the number of products it contains
-
Choose Product Type
- Select from the dropdown:
- Simple (Purchasable): Regular purchasable products
- External/Affiliate Product: External/affiliate products
- Select from the dropdown:
-
Start Processing
- Click "Save Changes" button
- Watch the progress bar and logs in real-time
- The process runs in batches with automatic delays
-
Review Results
- Check the statistics (Success/Errors)
- Review the detailed logs
- Processing completes automatically
🔧 How It Works
Product Type Switching
When switching product types:
- Simple → External: Product URL is preserved if it exists
- External → Simple: Product URL is saved before switching and can be restored later
- Same Type: Products already of the target type are skipped
Batch Processing
- Processes 5 products at a time
- 500ms delay between batches
- Prevents server overload on large product catalogs
- Real-time progress updates
Session Management
- Each processing session is tracked with a unique ID
- Session data stored in WordPress options table
- Progress can be monitored via AJAX polling
📁 File Structure
brand-product-type-switcher/
├── brand-product-type-switcher.php # Main plugin file
├── README.md # This file
├── includes/
│ └── admin-page.php # Admin page template
└── assets/
├── css/
│ └── admin.css # Admin styles
└── js/
└── admin.js # Admin JavaScript
🛠️ Development
Code Standards
This plugin follows:
- WordPress Coding Standards
- WordPress Plugin API best practices
- WooCommerce integration standards
- PSR-12 PHP coding standards (where applicable)
Hooks and Filters
The plugin uses standard WordPress hooks:
admin_menu- Adds admin menuadmin_enqueue_scripts- Enqueues scripts/styleswp_ajax_*- AJAX handlers
AJAX Endpoints
bpt_s_get_brands- Get list of brandsbpt_s_switch_product_types- Initialize processingbpt_s_process_batch- Process batch of productsbpt_s_get_progress- Get processing progress
🔒 Security
- All AJAX requests use nonce verification
- Capability checks (
manage_woocommerce) - Input sanitization and validation
- Output escaping
- Direct file access prevention
📝 Changelog
1.0.0
- Initial release
- Brand selection interface
- Product type switching (Simple/External)
- Progress tracking
- Detailed logging
- Product URL preservation
🤝 Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
📄 License
This plugin is licensed under the GPL v2 or later.
Copyright (C) 2025 Maxim Shiyan
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
🐛 Troubleshooting
Brands Not Loading
- Ensure
product_brandtaxonomy exists - Check that brands have products assigned
- Verify WooCommerce is active
Processing Stops
- Check browser console for JavaScript errors
- Verify server can handle AJAX requests
- Check WordPress debug log
Product URL Not Preserved
- Ensure products have Product URL set before switching
- Check WooCommerce product meta
- Verify product type is correctly set
📞 Support
For support, please open an issue on GitHub or contact the plugin author.
🙏 Credits
Developed by Maxim Shiyan following WordPress Codex standards and WooCommerce best practices.
Author: Maxim Shiyan
GitHub: @avorite
Made with ❤️ for WordPress & WooCommerce