isEnabled()) || ($categoryExportModule && $categoryExportModule->isEnabled()) ); if (!$showSection) return; use Aikanen\Modules\CategoryImport\CategoryImportMapper; // Build current mappings: WC product_cat terms that have _aikanen_group_id $mappedTerms = get_terms([ 'taxonomy' => 'product_cat', 'hide_empty' => false, 'meta_query' => [[ 'key' => CategoryImportMapper::META_AIKANEN_ID, 'compare' => 'EXISTS', ]], ]); $mappedByGroupId = []; // group_id => WP_Term foreach ($mappedTerms as $term) { $groupId = get_term_meta($term->term_id, CategoryImportMapper::META_AIKANEN_ID, true); if ($groupId) { $mappedByGroupId[$groupId] = $term; } } // All WC categories for the mapping dropdowns $allTerms = get_terms(['taxonomy' => 'product_cat', 'hide_empty' => false]); ?>

$term): ?>
name); ?> (ID: term_id; ?>)
term_id); ?>

!isset($mappedByGroupId[$g['id']])); $mapped = array_filter($aikanenGroups, fn($g) => isset($mappedByGroupId[$g['id']])); ?>

()

✓