Dalibor Votruba 822d122cc8 regenerate translation 3 月之前
..
assets e573694268 Add Remove Not Assigned Media feature, fix physical file deletion — v1.5.2 3 月之前
includes e573694268 Add Remove Not Assigned Media feature, fix physical file deletion — v1.5.2 3 月之前
languages 822d122cc8 regenerate translation 3 月之前
views e573694268 Add Remove Not Assigned Media feature, fix physical file deletion — v1.5.2 3 月之前
CLAUDE.md 121b939931 Update documentation for v1.5.2 3 月之前
directory-structure.txt 3436f6231a studiou-wc-product-cat-manage: add translation support 1 年之前
instructions.txt e573694268 Add Remove Not Assigned Media feature, fix physical file deletion — v1.5.2 3 月之前
readme.md 121b939931 Update documentation for v1.5.2 3 月之前
studiou-wc-product-cat-manage.php e573694268 Add Remove Not Assigned Media feature, fix physical file deletion — v1.5.2 3 月之前

readme.md

QDR - Studiou WC Export/Import Product Categories

Version: 1.5.2

A WordPress plugin that extends WooCommerce to provide batch export and import functionality for both product categories and products, along with category manipulation tools.

Description

QDR - Studiou WC Export/Import Product Categories is a powerful WordPress plugin for WooCommerce store administrators who need to manage product categories and products in bulk. This plugin allows you to:

  • Export and import product categories with all their settings
  • Export and import variable products and their variations
  • Manipulate categories (move products, batch update descriptions, delete products)
  • Support for WooCommerce Protected Categories extension

The plugin provides a complete solution for bulk product and category management with comprehensive validation, error reporting, and progress tracking.

Features

Category Management

  • Export all product categories to a CSV file
  • Import product categories from a CSV file
  • Add, update, or delete product categories in batch
  • Support for WooCommerce Protected Categories visibility settings
  • Move products between categories in bulk
  • Batch description update for multiple categories
  • Delete products in category - permanently delete all products and variants from selected categories
  • Clear Media Categories - permanently delete all media files from selected media categories (NEW in v1.5)
  • Remove Not Assigned Media - permanently delete all unused uncategorized media files (NEW in v1.5.2)

Product Management (NEW in v1.4)

  • Export products to CSV - Export variable products and variations by category selection
  • Import products from CSV - Batch create/update variable products and variations
  • Full support for product attributes and variations
  • Image URL handling with validation
  • Min/Max quantity support
  • Comprehensive import rules with validation
  • Failed products download for retry

General Features

  • User-friendly interface integrated with WooCommerce admin
  • Real-time progress tracking for bulk operations
  • Comprehensive validation and error reporting
  • Full translation support (English/Czech)

Requirements

  • WordPress 6.8.1 or higher
  • PHP 8.2 or higher
  • WooCommerce 9.8 or higher
  • WooCommerce Protected Categories 2.7 or higher

Installation

  1. Download the plugin ZIP file
  2. Go to WordPress Dashboard > Plugins > Add New
  3. Click "Upload Plugin" and select the ZIP file
  4. Click "Install Now"
  5. Activate the plugin

CSV Formats

Product Category CSV Format

The plugin uses CSV files with the following columns for categories:

Column Description
name Product Category Name
url-name Product Category URL slug
parent-name Parent Product Category Name (empty if no parent)
description Product Category description
display-type Product Category display type (values: 'default', 'products', 'subcategories', 'both')
visibility Product Category visibility (values: 'public', 'protected')
protected-passwords Pipe (|) separated passwords if visibility is 'protected'
operation Record operation: 'A' - add, 'U' - update, 'D' - delete

Product CSV Format (NEW in v1.4)

The plugin uses CSV files with the following columns for products:

Column Description
ID Product ID (0 for new products)
Typ Product type (only "variable" or "variation" allowed)
Katalogové číslo SKU (must be unique)
Jméno Product name
Nadřazené Parent product SKU (for variations only)
Krátký popis Short description
Popis Description
Název 1 vlastnosti Attribute 1 name
Hodnota(y) 1 vlastnosti Attribute 1 value(s) (pipe-separated for variable products)
Kategorie Categories (pipe-separated)
Obrázky Image URL (must be valid and accessible)
Běžná cena Regular price (required for variations)
Vlastnost 1 viditelnost Attribute 1 visibility (1 or 0)
Vlastnost 1 globální Attribute 1 global (1 or 0)
Vlastnost 1 varianta Attribute 1 used for variations (1 or 0)
Povolit zákaznické recenze? Enable reviews (1 or 0)
Minimum Quantity Minimum order quantity
Maximum Quantity Maximum order quantity

Usage

Exporting Product Categories

  1. Go to Products > Export Product Categories
  2. Click "Export Product Categories"
  3. Download the generated CSV file

Importing Product Categories

  1. Go to Products > Import Product Categories
  2. Select your CSV file
  3. Click "Import Product Categories"
  4. Review the import results

Exporting Products (NEW in v1.4)

  1. Go to Products > Product Export
  2. Select categories using checkboxes
    • Use "Select All" to select all categories
    • Use "Deselect All" to deselect all categories
  3. Click "Export Selected Products"
  4. Download the generated CSV file

Importing Products (NEW in v1.4)

  1. Go to Products > Product Import
  2. Select your CSV file (UTF-8 encoding)
  3. Click "Process Import File"
  4. Watch the progress bar as products are being imported in batches
    • Products are processed 5 at a time to avoid timeout issues
    • Progress shows "Processing: X / Y products"
  5. Review the import results showing:
    • Successful imports
    • Failed imports
    • Skipped items
    • Detailed messages for skipped/failed items only
  6. If there are failed items, click "Save Failed Products" to download a CSV file with failed items for correction and re-import

Product Import Features:

  • Batch Processing: Processes 5 products per batch to avoid PHP timeouts
  • Auto-Create Categories: Missing categories are automatically created during import
  • Real-Time Progress: Shows exact progress (e.g., "Processing: 15 / 50 products")
  • Smart Category Matching: Tries exact name, slug, and case-insensitive matching
  • Image Optimization: 30-second timeout per image, intermediate sizes disabled for speed
  • Detailed Logging: All operations logged for debugging (prefix: "STUDIOU WC IMPORT:")

Product Import Rules:

  • Rule 1: All operations performed via WooCommerce API (not direct SQL)
  • Rule 2: If ID = 0, item will be created; otherwise updated
  • Rule 3: Only "variable" or "variation" types are allowed
  • Rule 4: SKU (Katalogové číslo) must be unique in WooCommerce database
  • Rule 5: Image URL must be valid format (accessibility checked during download)
  • Rule 6: Parent reference (Nadřazené) must point to an existing variable product SKU
  • Rule 7: Variations must have a regular price (Běžná cena)

Important Notes:

  • Categories have unique names throughout the system (no hierarchy path needed)
  • Category names can contain dashes, dots, and special characters
  • Failed image downloads don't stop the import, they're just logged
  • Import can handle large files thanks to batch processing

Category Manipulations

Moving Products Between Categories

  1. Go to Products > Category Manipulations
  2. Select the source category (from which products will be moved)
  3. Select the target category (to which products will be moved)
  4. Click "Do" to execute the move operation
  5. Review the results showing how many products were moved

Important Notes about Moving Products:

  • Products can be assigned to multiple categories. This operation will remove the product from the source category and add it to the target category.
  • If a product is only assigned to the source category, it will be moved entirely to the target category.
  • If a product is assigned to multiple categories including the source category, it will remain in the other categories and be moved to the target category.
  • The operation processes all products regardless of their status (published, draft, private).

Batch Description Between Categories

  1. Go to Products > Category Manipulations
  2. Scroll to the "Batch description between categories" section
  3. Select one or more categories using the checkboxes
    • Use "Check All" to select all categories
    • Use "Uncheck All" to deselect all categories
  4. Enter the description text in the textarea
  5. Click "Do" to apply the description to all selected categories
  6. Review the results showing how many categories were updated

Important Notes about Batch Description:

  • The operation will overwrite the existing descriptions for all selected categories
  • Categories can be selected individually or in bulk using the check/uncheck all buttons
  • The description field supports multi-line text
  • All selected categories will receive exactly the same description

Delete Products in Category

  1. Go to Products > Category Manipulations
  2. Scroll to the "Delete products in category" section
  3. Select one or more categories using the checkboxes
    • Use "Check All" to select all categories
    • Use "Uncheck All" to deselect all categories
  4. Click "Delete" button (you will be asked to confirm)
  5. Watch the progress bar as products are being deleted in batches
  6. Review the deletion statistics showing:
    • Total products deleted
    • Failed deletions (if any)
    • Failed product IDs (if any)

Important Notes about Delete Products:

  • THIS OPERATION PERMANENTLY DELETES ALL PRODUCTS AND THEIR VARIANTS from the selected categories
  • THIS ACTION CANNOT BE UNDONE!
  • Products are deleted using WooCommerce operations to ensure proper cleanup
  • Variable products will have all their variations deleted automatically
  • Products are processed in batches of 10 to prevent timeouts
  • A real-time progress bar shows the deletion progress
  • If a product belongs to multiple categories, it will still be deleted entirely from the system
  • The page will automatically reload after successful deletion to update category counts

Clear Media Categories (NEW in v1.5)

  1. Go to Products > Category Manipulations
  2. Scroll to the "Clear Media Categories" section
  3. Select one or more media categories using the checkboxes
    • Use "Check All" to select all media categories
    • Use "Uncheck All" to deselect all media categories
  4. Click "Delete" button (you will be asked to confirm)
  5. Watch the progress bar as media files are being deleted in batches
  6. Review the deletion statistics showing:
    • Total media files deleted
    • Failed deletions (if any)
    • Failed media IDs (if any)

Important Notes about Clear Media Categories:

  • THIS OPERATION PERMANENTLY DELETES ALL MEDIA FILES from the selected media categories
  • The files will be removed from the server. THIS ACTION CANNOT BE UNDONE!
  • Requires a media category plugin (e.g., Media Library Categories) to be installed
  • Media files are deleted using wp_delete_attachment() for proper cleanup
  • Media files are processed in batches of 10 to prevent timeouts
  • A real-time progress bar shows the deletion progress
  • The page will automatically reload after successful deletion to update category counts

Remove Not Assigned Media (NEW in v1.5.2)

  1. Go to Products > Category Manipulations
  2. Scroll to the "Remove Not Assigned Media" section
  3. The button shows the count of unused uncategorized media files
  4. Click "Delete unused uncategorized media (N)" button (you will be asked to confirm)
  5. Watch the progress bar as media files are being deleted in batches
  6. Review the deletion statistics

What counts as "unused uncategorized media":

  • Not assigned to any media category
  • Not used as a featured image for any post or product
  • Not used in any WooCommerce product image gallery
  • Not attached to any post (post_parent = 0)

Important Notes about Remove Not Assigned Media:

  • THIS OPERATION PERMANENTLY DELETES MEDIA FILES that meet all criteria above
  • The files will be removed from the server. THIS ACTION CANNOT BE UNDONE!
  • Media files are processed in batches of 10 to prevent timeouts
  • Both the WordPress attachment post and the physical files (including thumbnails) are deleted
  • A real-time progress bar shows the deletion progress
  • The page will automatically reload after successful deletion to update the count

Sample CSVs

Sample Product Category CSV

name,url-name,parent-name,description,display-type,visibility,protected-passwords,operation
"Clothing","clothing","","Top quality clothing","default","public","","A"
"Men","men","Clothing","Men's clothing","products","public","","A"
"Women","women","Clothing","Women's clothing","products","protected","password123","A"
"Kids","kids","Clothing","Kids clothing","products","public","","U"
"Accessories","accessories","","All accessories","default","public","","D"

Category Import Operations:

  • A - Add a new product category
  • U - Update an existing product category (identified by name)
  • D - Delete an existing product category (identified by name)

Sample Product CSV (NEW in v1.4)

ID,Typ,Katalogové číslo,Jméno,Nadřazené,Krátký popis,Popis,Název 1 vlastnosti,Hodnota(y) 1 vlastnosti,Kategorie,Obrázky,Běžná cena,Vlastnost 1 viditelnost,Vlastnost 1 globální,Vlastnost 1 varianta,Povolit zákaznické recenze?,Minimum Quantity,Maximum Quantity
0,variable,T-SHIRT-001,"Basic T-Shirt","","Comfortable cotton t-shirt","High-quality cotton t-shirt in various sizes",Size,"S|M|L|XL","Clothing|Men","https://example.com/tshirt.jpg","",1,1,1,1,1,10
0,variation,T-SHIRT-001-S,"Basic T-Shirt - S",T-SHIRT-001,"","",Size,S,"","https://example.com/tshirt-s.jpg",19.99,0,1,0,0,1,10
0,variation,T-SHIRT-001-M,"Basic T-Shirt - M",T-SHIRT-001,"","",Size,M,"","https://example.com/tshirt-m.jpg",19.99,0,1,0,0,1,10

Menu Structure

After activation, the plugin adds the following menu items under Products in the WordPress admin:

Category Management

  • Import Product Categories
  • Export Product Categories
  • Category Manipulations
    • Move products between categories
    • Batch description between categories
    • Delete products in category
    • Clear Media Categories (NEW in v1.5)
    • Remove Not Assigned Media (NEW in v1.5.2)

Product Management (NEW in v1.4)

  • Product Import - Batch import variable products and variations
  • Product Export - Export products by category selection

License

GPL v2 or later - https://www.gnu.org/licenses/gpl-2.0.html

Author

Dalibor Votruba
Website: Quadarax

Support

For support, please visit https://www.quadarax.com/plugins/studiou-wc-product-cat-manage

Changelog

Version 1.5.2

  • NEW: Remove Not Assigned Media - permanently delete all unused uncategorized media files
    • Button with count of unused uncategorized media
    • Detects media not in any category, not used as featured image, not in product galleries, not attached to any post
    • Confirmation dialog before deletion
    • Real-time progress bar with batch processing (10 files at a time)
    • Comprehensive deletion statistics and error reporting
  • Fix: Media deletion now properly deletes physical files and attachment posts
    • After wp_delete_attachment(), verifies post was actually deleted via direct DB check
    • If post still exists, forces manual cleanup (term relationships, postmeta, post row)
    • Explicitly deletes physical files (main file + thumbnails) from disk
  • 2 new AJAX handlers: studiou_wcpcm_remove_unassigned_media, studiou_wcpcm_remove_unassigned_media_batch

Version 1.5.1

  • Fix: Clear Media Categories JS event handler not binding due to browser-cached old JS
  • Fix: Auto-detect any custom taxonomy registered for attachments (no longer limited to 3 hardcoded names)
  • Fix: Use spread operator for $wpdb->prepare() args for WP 6.8+ compatibility
  • Fix: Add return after wp_send_json_error() calls to prevent execution leak
  • Fix: Force wp_update_term_count_now() after batch deletion to refresh category counts
  • Improved JS initialization: each form init wrapped in try-catch (safeInit) so one error cannot block others
  • Always-on error logging for media operations (prefix: STUDIOU WC MEDIA:)
  • Added onsubmit="return false;" fallback on clear media form

Version 1.5.0

  • NEW: Clear Media Categories - permanently delete all media files from selected media categories
    • Checkbox list of media categories with file count per category
    • Check All / Uncheck All functionality
    • Confirmation dialog before deletion
    • Real-time progress bar for deletion operations
    • Batch processing for large-scale deletions (processes 10 media files at a time)
    • Comprehensive deletion statistics and error reporting
    • Enhanced warning messages for destructive operations
    • Auto-detection of media category taxonomy for attachments
    • Graceful fallback message when no media category plugin is installed
  • 2 new AJAX handlers: studiou_wcpcm_clear_media, studiou_wcpcm_clear_media_batch
  • Updated Category Manipulations page with new Clear Media Categories section
  • Added Important Notes entry for the new feature

Version 1.4.0

  • NEW: Product Import - Batch import variable products and variations from CSV
    • Batch processing - Processes 5 products per batch to avoid PHP timeout (60 sec limit)
    • Auto-create categories - Missing categories automatically created during import
    • Support for variable products with attributes
    • Support for product variations with parent references
    • Image URL handling with 30-second timeout, intermediate sizes disabled
    • Min/Max quantity support
    • 7 comprehensive import rules with validation
    • Failed products download for retry
    • Real-time progress bar showing "Processing: X / Y products"
    • Comprehensive error logging (always enabled, prefix: "STUDIOU WC IMPORT:")
    • Logs only skipped/failed items (not successful ones)
  • NEW: Product Export - Export products by category selection
    • Export variable products and their variations
    • Full category paths exported for subcategories (format: "Parent > Child")
    • Category hierarchy selection with product counts
    • Select All/Deselect All functionality
    • Full product data export (18 columns)
  • Technical improvements:
    • Two-phase import: Parse CSV to transient, then batch process
    • Smart category matching: exact name, slug, case-insensitive
    • Simple category lookup only (categories have unique names)
    • Image validation only checks format, not HTTP accessibility (prevents timeouts)
  • Added 3 new database/import/export classes for product management
  • Added 2 new view templates for product import/export
  • Enhanced JavaScript with recursive batch processing handlers
  • Added 71 new translation strings (English/Czech)
  • Updated plugin description to reflect product management capabilities
  • All operations use WooCommerce API (no direct SQL)

Version 1.3.0

  • New feature: Delete products in category - permanently delete all products and variants from selected categories
  • Real-time progress bar for deletion operations
  • Batch processing for large-scale deletions (processes 10 products at a time)
  • Automatic handling of variable products and their variations
  • Comprehensive deletion statistics and error reporting
  • Enhanced warning messages for destructive operations
  • Improved user interface with confirmation dialogs

Version 1.2.0

  • Added Category Manipulations functionality
  • New feature: Move products between categories
  • New feature: Batch description between categories
  • Enhanced admin interface with better user feedback
  • Improved security with proper nonce validation
  • Added comprehensive documentation
  • Direct database queries for reliable product detection

Version 1.1.0

  • Initial release with import/export functionality
  • Support for WooCommerce Protected Categories
  • CSV-based batch operations