Plugin Directory

Changeset 3401784


Ignore:
Timestamp:
11/24/2025 11:16:08 AM (4 months ago)
Author:
techspawn1
Message:

Deploy version 1.1.3 from GitLab CI

Location:
multiloca-lite-multi-location-inventory
Files:
38 edited
1 copied

Legend:

Unmodified
Added
Removed
  • multiloca-lite-multi-location-inventory/tags/1.1.3/admin/class-multiloca-lite-admin.php

    r3396942 r3401784  
    3838        // Load custom inventory fields
    3939        require_once MULTILOCA_LITE_PLUGIN_PATH . 'admin/partials/multiloca-lite-custom-inventory-fields.php';
    40        
    41         // Add order field to location taxonomy
    42         add_action('locations_add_form_fields', array($this, 'add_location_order_field'));
    43         add_action('locations_edit_form_fields', array($this, 'edit_location_order_field'), 10, 2);
    44         add_action('created_locations', array($this, 'save_location_order_field'));
    45         add_action('edited_locations', array($this, 'save_location_order_field'));
    4640
    4741        add_filter('parent_file', array($this, 'wcmlim_lite_submenu_highlight'));
     
    6155        );
    6256        // Only include on our settings pages and taxonomy pages
    63         if ($_GET['taxonomy'] === 'locations-lite' || strpos($hook, 'multiloca-lite-settings') !== false) {
     57        if ($_GET['taxonomy'] === 'locations' || strpos($hook, 'multiloca-lite-settings') !== false) {
    6458           
    6559           
     
    149143            __('Locations', 'multiloca-lite-multi-location-inventory'),
    150144            'manage_options',
    151             'edit-tags.php?taxonomy=locations-lite&post_type=product',
     145            'edit-tags.php?taxonomy=locations&post_type=product',
    152146            null
    153147        );
     
    614608        global $current_screen;
    615609        $taxonomy = $current_screen->taxonomy;
    616         if ($taxonomy == 'locations-lite') {
     610        if ($taxonomy == 'locations') {
    617611            $parent_file = 'multiloca-lite-settings';
    618612        }
     
    621615
    622616    public function wcmlim_lite_highlight_submenu($submenu_file) {
    623         $locations = 'edit-tags.php?taxonomy=locations-lite&post_type=product';
     617        $locations = 'edit-tags.php?taxonomy=locations&post_type=product';
    624618
    625619        if (esc_html($locations) == $submenu_file) {
    626             return 'edit-tags.php?taxonomy=locations-lite&post_type=product';
     620            return 'edit-tags.php?taxonomy=locations&post_type=product';
    627621        }
    628622        return $submenu_file;
  • multiloca-lite-multi-location-inventory/tags/1.1.3/admin/js/multiloca-lite-admin.js

    r3336945 r3401784  
    1111
    1212        function validate_add_location() {
    13             if ($(".taxonomy-locations-lite").length > 0) {
     13            if ($(".taxonomy-locations").length > 0) {
    1414
    1515            var tag_name = $('#tag-name').val();
  • multiloca-lite-multi-location-inventory/tags/1.1.3/admin/js/multiloca-lite-product-edit.js

    r3374381 r3401784  
    2727            setTimeout(function() {
    2828                // If locations are checked, suggest enabling stock management
    29                 if ($('#taxonomy-locations-lite input:checked').length > 0 && !$('#_manage_stock').is(':checked')) {
     29                if ($('#taxonomy-locations input:checked').length > 0 && !$('#_manage_stock').is(':checked')) {
    3030                    log('Locations selected but stock management not enabled');
    3131                    // Add a notice above the stock management field
     
    4444        function getSelectedLocationIds() {
    4545            const selectedIds = [];
    46             $('#taxonomy-locations-lite input:checked').each(function() {
     46           
     47            // Check multiple possible selectors for the taxonomy checkboxes
     48            const $checkboxes = $('#taxonomy-locations input[type="checkbox"]:checked, ' +
     49                                 '#locationsdiv input[type="checkbox"]:checked, ' +
     50                                 '.categorydiv[id*="locations"] input[type="checkbox"]:checked');
     51           
     52            $checkboxes.each(function() {
    4753                const id = $(this).val();
    48                 if (id) {
     54                // Skip the 0 value checkbox (usually "All" checkbox)
     55                if (id && id !== '0') {
    4956                    selectedIds.push(id);
    5057                }
     
    216223        // For new products, select all locations
    217224        if (window.location.href.indexOf('post-new.php') !== -1) {
    218             $('#taxonomy-locations-lite input[type="checkbox"]').prop('checked', true);
     225            $('#taxonomy-locations input[type="checkbox"]').prop('checked', true);
    219226            log('New product - checking all location boxes');
    220227        }
     
    276283
    277284        // Listen for changes to checkboxes in the locations taxonomy box
    278         $(document).on('change', '#taxonomy-locations-lite input[type="checkbox"]', function() {
     285        $(document).on('change', '#taxonomy-locations input[type="checkbox"]', function() {
    279286            log('Location checkbox changed');
    280287            updateLocationInventoryFields();
     
    282289
    283290        // Handle "Select All" and "Clear" actions
    284         $(document).on('click', '#locations-lite-all', function() {
     291        $(document).on('click', '#locations-all', function() {
    285292            log('Select All clicked');
    286293            setTimeout(updateLocationInventoryFields, 100);
    287294        });
    288295       
    289         $(document).on('click', '#locations-lite-none', function() {
     296        $(document).on('click', '#locations-none', function() {
    290297            log('Clear clicked');
    291298            setTimeout(updateLocationInventoryFields, 100);
     
    293300       
    294301        // Handle Most Used tab clicks
    295         $(document).on('click', '#locations-lite-pop', function() {
     302        $(document).on('click', '#locations-pop', function() {
    296303            log('Most Used clicked');
    297304            setTimeout(updateLocationInventoryFields, 100);
     
    304311                typeof settings.data === 'string' &&
    305312                (settings.data.indexOf('action=add-tag') !== -1 ||
    306                  settings.data.indexOf('action=add-locations-lite') !== -1 ||
    307                  settings.data.indexOf('taxonomy=locations-lite') !== -1)) {
     313                 settings.data.indexOf('action=add-locations') !== -1 ||
     314                 settings.data.indexOf('taxonomy=locations') !== -1)) {
    308315                log('AJAX completed - taxonomy updated');
    309316                setTimeout(updateLocationInventoryFields, 100);
  • multiloca-lite-multi-location-inventory/tags/1.1.3/admin/partials/multiloca-lite-custom-inventory-fields.php

    r3377945 r3401784  
    4848        }
    4949
    50         // Get the parent product ID for location linking
     50       
     51        // Get parent product for location linking
    5152        $variation = wc_get_product($variation_id);
    5253        if (!$variation || !$variation->is_type('variation')) {
     
    5657       
    5758        $parent_id = $variation->get_parent_id();
    58         $locations_linked = wp_get_object_terms($parent_id, 'locations-lite', ['fields' => 'ids']);
    59        
    60         // Get display settings
     59        $locations_linked = wp_get_object_terms($parent_id, 'locations', ['fields' => 'ids']);        // Get display settings
    6160        $heading_text = get_option('wcmlim_txt_in_fdiv', esc_html__('Location Availability', 'multiloca-lite-multi-location-inventory'));
    6261        $instock_text = get_option('wcmlim_txt_in_btn_instock', esc_html__('In Stock', 'multiloca-lite-multi-location-inventory'));
     
    7877            if ($order_by === 'priority') {
    7978                $locations = get_terms(array(
    80                     'taxonomy' => 'locations-lite',
     79                    'taxonomy' => 'locations',
    8180                    'hide_empty' => false,
    8281                    'include' => $locations_linked,
     
    8786            } else {
    8887                $locations = get_terms(array(
    89                     'taxonomy' => 'locations-lite',
     88                    'taxonomy' => 'locations',
    9089                    'hide_empty' => false,
    9190                    'include' => $locations_linked,
     
    582581       
    583582        // Get all available locations
    584         $locations = get_terms(array('taxonomy' => 'locations-lite', 'hide_empty' => false));
     583        $locations = get_terms(array('taxonomy' => 'locations', 'hide_empty' => false));
    585584       
    586585        if (empty($locations)) {
     
    611610                // Check for child locations
    612611                $child_locations = get_terms(array(
    613                     'taxonomy' => 'locations-lite',
     612                    'taxonomy' => 'locations',
    614613                    'hide_empty' => false,
    615614                    'parent' => $location->term_id,
     
    659658       
    660659        // Get linked/selected locations
    661         $locations_linked = wp_get_object_terms($product_id, 'locations-lite', ['fields' => 'ids']);
     660        $locations_linked = wp_get_object_terms($product_id, 'locations', ['fields' => 'ids']);
    662661       
    663662        if (empty($locations_linked)) {
     
    672671        // Get all locations and filter for the linked ones
    673672        $locations = get_terms(array(
    674             'taxonomy' => 'locations-lite',
     673            'taxonomy' => 'locations',
    675674            'hide_empty' => false,
    676675            'include' => $locations_linked // Only include linked locations
     
    723722       
    724723        // Get all available locations
    725         $locations = get_terms(array('taxonomy' => 'locations-lite', 'hide_empty' => false));
     724        $locations = get_terms(array('taxonomy' => 'locations', 'hide_empty' => false));
    726725       
    727726        if (!empty($locations)) {
     
    768767       
    769768        // Get linked/selected locations from the parent product
    770         $locations_linked = wp_get_object_terms($parent_id, 'locations-lite', ['fields' => 'ids']);
     769        $locations_linked = wp_get_object_terms($parent_id, 'locations', ['fields' => 'ids']);
    771770       
    772771        if (empty($locations_linked)) {
     
    782781        // Get all locations to loop through
    783782        $all_locations = get_terms(array(
    784             'taxonomy' => 'locations-lite',
     783            'taxonomy' => 'locations',
    785784            'hide_empty' => false
    786785        ));
     
    806805                    // Also update the parent product's location link if needed
    807806                    if (!in_array($location_id, $locations_linked)) {
    808                         wp_set_object_terms($parent_id, (int)$location_id, 'locations-lite', true);
     807                        wp_set_object_terms($parent_id, (int)$location_id, 'locations', true);
    809808                    }
    810809                } else {
  • multiloca-lite-multi-location-inventory/tags/1.1.3/includes/class-multiloca-lite-activator.php

    r3396942 r3401784  
    6161        flush_rewrite_rules();
    6262    }
     63   
     64    /**
     65     * Run migration after plugin is fully loaded
     66     * This is hooked to 'init' with high priority to ensure taxonomies are registered
     67     */
     68    public static function run_migration_on_init() {
     69        // Only run if not already migrated
     70        if (!get_option('wcmlim_taxonomy_migrated', false)) {
     71            self::migrate_taxonomy_from_locations_lite_to_locations();
     72        }
     73    }
     74   
     75    /**
     76     * Migrate taxonomy data from 'locations-lite' to 'locations'
     77     * This runs only once to preserve existing user data during the taxonomy rename
     78     */
     79    public static function migrate_taxonomy_from_locations_lite_to_locations() {
     80        // Check if migration has already been completed
     81        if (get_option('wcmlim_taxonomy_migrated', false)) {
     82            return; // Migration already done, skip
     83        }
     84       
     85        // Check if new taxonomy exists
     86        if (!taxonomy_exists('locations')) {
     87            // New taxonomy not registered yet, will retry on next init
     88            return;
     89        }
     90       
     91        // Temporarily register the old taxonomy to access existing data
     92        // This is needed because we removed it from the main codebase
     93        if (!taxonomy_exists('locations-lite')) {
     94            register_taxonomy('locations-lite', 'product', array(
     95                'hierarchical' => true,
     96                'public' => false,
     97                'show_ui' => false,
     98                'show_in_rest' => false,
     99            ));
     100        }
     101       
     102        // Get all terms from the old taxonomy
     103        $old_terms = get_terms(array(
     104            'taxonomy' => 'locations-lite',
     105            'hide_empty' => false,
     106            'orderby' => 'term_id',
     107            'order' => 'ASC',
     108        ));
     109       
     110        if (empty($old_terms) || is_wp_error($old_terms)) {
     111            // No terms to migrate, mark as done
     112            update_option('wcmlim_taxonomy_migrated', true);
     113            return;
     114        }
     115       
     116        // Array to map old term IDs to new term IDs
     117        $term_id_mapping = array();
     118        // Array to track which terms were newly created (vs already existed)
     119        $newly_created_terms = array();
     120       
     121        // First pass: Create all terms in the new taxonomy
     122        foreach ($old_terms as $old_term) {
     123            // Check if term already exists in new taxonomy
     124            $existing_term = term_exists($old_term->slug, 'locations');
     125           
     126            if ($existing_term) {
     127                // Term already exists - skip it to preserve manually created data
     128                // Don't add to mapping, so it won't be processed in later passes
     129                continue;
     130            } else {
     131                // Create new term in 'locations' taxonomy
     132                $new_term = wp_insert_term(
     133                    $old_term->name,
     134                    'locations',
     135                    array(
     136                        'description' => $old_term->description,
     137                        'slug' => $old_term->slug,
     138                        'parent' => 0, // We'll set parent in second pass
     139                    )
     140                );
     141               
     142                if (!is_wp_error($new_term)) {
     143                    $term_id_mapping[$old_term->term_id] = $new_term['term_id'];
     144                    $newly_created_terms[] = $new_term['term_id'];
     145                   
     146                    // Copy all term meta from old term to new term
     147                    self::copy_term_meta($old_term->term_id, $new_term['term_id']);
     148                }
     149            }
     150        }
     151       
     152        // Second pass: Set up parent-child relationships
     153        foreach ($old_terms as $old_term) {
     154            if ($old_term->parent > 0 && isset($term_id_mapping[$old_term->term_id]) && isset($term_id_mapping[$old_term->parent])) {
     155                wp_update_term(
     156                    $term_id_mapping[$old_term->term_id],
     157                    'locations',
     158                    array('parent' => $term_id_mapping[$old_term->parent])
     159                );
     160            }
     161        }
     162       
     163        // Third pass: Migrate product-term relationships
     164        global $wpdb;
     165       
     166        // Get all product IDs that have the old taxonomy terms
     167        $product_ids = $wpdb->get_col($wpdb->prepare(
     168            "SELECT DISTINCT object_id
     169             FROM {$wpdb->term_relationships} tr
     170             INNER JOIN {$wpdb->term_taxonomy} tt ON tr.term_taxonomy_id = tt.term_taxonomy_id
     171             WHERE tt.taxonomy = %s",
     172            'locations-lite'
     173        ));
     174       
     175        foreach ($product_ids as $product_id) {
     176            // Get old terms for this product
     177            $old_product_terms = wp_get_object_terms($product_id, 'locations-lite', array('fields' => 'ids'));
     178           
     179            if (!empty($old_product_terms) && !is_wp_error($old_product_terms)) {
     180                // Map old term IDs to new term IDs
     181                $new_term_ids = array();
     182                foreach ($old_product_terms as $old_term_id) {
     183                    if (isset($term_id_mapping[$old_term_id])) {
     184                        $new_term_ids[] = $term_id_mapping[$old_term_id];
     185                    }
     186                }
     187               
     188                // Assign new terms to product - APPEND to existing relationships
     189                if (!empty($new_term_ids)) {
     190                    wp_set_object_terms($product_id, $new_term_ids, 'locations', true);
     191                }
     192            }
     193           
     194            // Migrate post meta: wcmlim_stock_at_{term_id} and wcmlim_product_availability_at_{term_id}
     195            // Only copy for newly created terms to preserve manual data
     196            foreach ($term_id_mapping as $old_term_id => $new_term_id) {
     197                // Skip if this term already existed (not in newly created list)
     198                if (!in_array($new_term_id, $newly_created_terms)) {
     199                    continue;
     200                }
     201               
     202                // Copy stock meta
     203                $stock_meta_key_old = 'wcmlim_stock_at_' . $old_term_id;
     204                $stock_meta_key_new = 'wcmlim_stock_at_' . $new_term_id;
     205                $stock_value = get_post_meta($product_id, $stock_meta_key_old, true);
     206               
     207                if ($stock_value !== '') {
     208                    update_post_meta($product_id, $stock_meta_key_new, $stock_value);
     209                }
     210               
     211                // Copy availability meta
     212                $avail_meta_key_old = 'wcmlim_product_availability_at_' . $old_term_id;
     213                $avail_meta_key_new = 'wcmlim_product_availability_at_' . $new_term_id;
     214                $avail_value = get_post_meta($product_id, $avail_meta_key_old, true);
     215               
     216                if ($avail_value !== '') {
     217                    update_post_meta($product_id, $avail_meta_key_new, $avail_value);
     218                }
     219            }
     220        }
     221       
     222        // Mark migration as complete
     223        update_option('wcmlim_taxonomy_migrated', true);
     224    }
     225   
     226    /**
     227     * Copy all term meta from old term to new term
     228     */
     229    private static function copy_term_meta($old_term_id, $new_term_id) {
     230        // List of all term meta keys used by the plugin
     231        $meta_keys = array(
     232            'wcmlim_street_address',
     233            'wcmlim_city',
     234            'wcmlim_state',
     235            'wcmlim_postcode',
     236            'wcmlim_country_state',
     237            'wcmlim_email',
     238            'wcmlim_phone',
     239            'wcmlim_business_hours',
     240            'wcmlim_location_priority',
     241            'wcmlim_start_time',
     242            'wcmlim_end_time',
     243            'wcmlim_street_number',
     244            'wcmlim_route',
     245            'wcmlim_locality',
     246            'wcmlim_administrative_area_level_1',
     247            'wcmlim_postal_code',
     248            'wcmlim_country',
     249            'wcmlim_lat',
     250            'wcmlim_lng',
     251            'wcmlim_linked_users',
     252            'wcmlim_locator',
     253        );
     254       
     255        foreach ($meta_keys as $meta_key) {
     256            $meta_value = get_term_meta($old_term_id, $meta_key, true);
     257            if ($meta_value !== '') {
     258                update_term_meta($new_term_id, $meta_key, $meta_value);
     259            }
     260        }
     261    }
    63262}
  • multiloca-lite-multi-location-inventory/tags/1.1.3/includes/class-multiloca-lite-cart-location.php

    r3377945 r3401784  
    417417       
    418418        // Get all linked locations for this product
    419         $linked_locations = wp_get_object_terms($product_id, 'locations-lite', array('fields' => 'ids'));
     419        $linked_locations = wp_get_object_terms($product_id, 'locations', array('fields' => 'ids'));
    420420       
    421421        if (empty($linked_locations)) {
  • multiloca-lite-multi-location-inventory/tags/1.1.3/includes/class-multiloca-lite-taxonomy.php

    r3396942 r3401784  
    2020       
    2121        // Add custom fields to location taxonomy
    22         add_action('locations-lite_add_form_fields', array($this, 'add_taxonomy_fields'), 10);
    23         add_action('locations-lite_edit_form_fields', array($this, 'edit_taxonomy_fields'), 10, 2);
    24         add_action('created_locations-lite', array($this, 'save_taxonomy_fields'), 10, 2);
    25         add_action('edited_locations-lite', array($this, 'save_taxonomy_fields'), 10, 2);
     22        add_action('locations_add_form_fields', array($this, 'add_taxonomy_fields'), 10);
     23        add_action('locations_edit_form_fields', array($this, 'edit_taxonomy_fields'), 10, 2);
     24        add_action('created_locations', array($this, 'save_taxonomy_fields'), 10, 2);
     25        add_action('edited_locations', array($this, 'save_taxonomy_fields'), 10, 2);
    2626    }
    2727
     
    7070    );
    7171   
    72     register_taxonomy('locations-lite', 'product', $args);
    73 
    74     register_term_meta('locations-lite', 'wcmlim_street_address', ['show_in_rest' => true]);
    75     register_term_meta('locations-lite', 'wcmlim_city', ['show_in_rest' => true]);
    76     register_term_meta('locations-lite', 'wcmlim_state', ['show_in_rest' => true]);
    77     register_term_meta('locations-lite', 'wcmlim_postcode', ['show_in_rest' => true]);
    78     register_term_meta('locations-lite', 'wcmlim_country_state', ['show_in_rest' => true]);
    79     register_term_meta('locations-lite', 'wcmlim_email', ['show_in_rest' => true]);
    80     register_term_meta('locations-lite', 'wcmlim_phone', ['show_in_rest' => true]);
    81     register_term_meta('locations-lite', 'wcmlim_business_hours', ['show_in_rest' => true]);
    82     register_term_meta('locations-lite', 'wcmlim_location_priority', ['show_in_rest' => true]);
    83     register_term_meta('locations-lite', 'wcmlim_start_time', ['show_in_rest' => true]);
    84     register_term_meta('locations-lite', 'wcmlim_end_time', ['show_in_rest' => true]);
    85     register_term_meta('locations-lite', 'wcmlim_street_number', ['show_in_rest' => true]);
    86     register_term_meta('locations-lite', 'wcmlim_route', ['show_in_rest' => true]);
    87     register_term_meta('locations-lite', 'wcmlim_locality', ['show_in_rest' => true]);
    88     register_term_meta('locations-lite', 'wcmlim_administrative_area_level_1', ['show_in_rest' => true]);
    89     register_term_meta('locations-lite', 'wcmlim_postal_code', ['show_in_rest' => true]);
    90     register_term_meta('locations-lite', 'wcmlim_country', ['show_in_rest' => true]);
    91     register_taxonomy_for_object_type('locations-lite', 'product');
    92     register_term_meta('locations-lite', 'wcmlim_lat', ['show_in_rest' => true]);
    93     register_term_meta('locations-lite', 'wcmlim_lng', ['show_in_rest' => true]);
    94     register_term_meta('locations-lite', 'wcmlim_linked_users', ['show_in_rest' => true]);
     72    register_taxonomy('locations', 'product', $args);
     73
     74    register_term_meta('locations', 'wcmlim_street_address', ['show_in_rest' => true]);
     75    register_term_meta('locations', 'wcmlim_city', ['show_in_rest' => true]);
     76    register_term_meta('locations', 'wcmlim_state', ['show_in_rest' => true]);
     77    register_term_meta('locations', 'wcmlim_postcode', ['show_in_rest' => true]);
     78    register_term_meta('locations', 'wcmlim_country_state', ['show_in_rest' => true]);
     79    register_term_meta('locations', 'wcmlim_email', ['show_in_rest' => true]);
     80    register_term_meta('locations', 'wcmlim_phone', ['show_in_rest' => true]);
     81    register_term_meta('locations', 'wcmlim_business_hours', ['show_in_rest' => true]);
     82    register_term_meta('locations', 'wcmlim_location_priority', ['show_in_rest' => true]);
     83    register_term_meta('locations', 'wcmlim_start_time', ['show_in_rest' => true]);
     84    register_term_meta('locations', 'wcmlim_end_time', ['show_in_rest' => true]);
     85    register_term_meta('locations', 'wcmlim_street_number', ['show_in_rest' => true]);
     86    register_term_meta('locations', 'wcmlim_route', ['show_in_rest' => true]);
     87    register_term_meta('locations', 'wcmlim_locality', ['show_in_rest' => true]);
     88    register_term_meta('locations', 'wcmlim_administrative_area_level_1', ['show_in_rest' => true]);
     89    register_term_meta('locations', 'wcmlim_postal_code', ['show_in_rest' => true]);
     90    register_term_meta('locations', 'wcmlim_country', ['show_in_rest' => true]);
     91    register_taxonomy_for_object_type('locations', 'product');
     92    register_term_meta('locations', 'wcmlim_lat', ['show_in_rest' => true]);
     93    register_term_meta('locations', 'wcmlim_lng', ['show_in_rest' => true]);
     94    register_term_meta('locations', 'wcmlim_linked_users', ['show_in_rest' => true]);
    9595
    9696    /**start Location Group */
    97     register_term_meta('locations-lite', 'wcmlim_locator', ['show_in_rest' => true]);
     97    register_term_meta('locations', 'wcmlim_locator', ['show_in_rest' => true]);
    9898    /** End Location Group */
    9999  }
  • multiloca-lite-multi-location-inventory/tags/1.1.3/includes/helper/multiloca-lite-inventory-helper.php

    r3377945 r3401784  
    1919add_action('init', 'wcmlim_init_inventory_hooks');
    2020
     21/**
     22 * Update inventory data when post meta is updated
     23 * This is called when location stock values change
     24 */
     25function wcmlim_update_inventory_data_addon($meta_id, $object_id, $meta_key, $meta_value) {
     26    // Only process for product posts
     27    if (get_post_type($object_id) !== 'product') {
     28        return;
     29    }
     30   
     31    // Check if this is a location stock meta key
     32    if (strpos($meta_key, 'wcmlim_stock_at_') !== 0) {
     33        return;
     34    }
     35   
     36    // Recalculate total stock for this product
     37    wcmlim_calculate_and_update_total_stock($object_id);
     38}
     39
    2140//This function will update the total stock count via external methods including importers & woocommerce API
    22 function wcmlim_update_inventory_data_addon($meta_id, $object_id, $meta_key, $_meta_value) {
    23     global $wpdb;
    24 
    25     // Check if we should skip calculations during order processing
    26     if (apply_filters('wcmlim_skip_stock_calculation', false)) {
    27         return;
    28     }
    29 
    30     // Check if the meta key relates to stock at a specific location
    31     if (!str_contains($meta_key, 'wcmlim_stock_at_')) {
    32         return;
    33     }
    34 
    35     $formatted_location_id = preg_replace('/[^0-9]/', '', $meta_key);
    36     $product_id = $object_id;
    37     $product = wc_get_product($product_id);
    38 
    39     if (!$product) {
    40         return;
    41     }
    42 
    43     $stock_value = (int)$_meta_value; // Convert to integer
    44 
    45     // Check if this location is linked to the product
    46     $linked_locations = wp_get_object_terms($product_id, 'locations-lite', array('fields' => 'ids'));
    47     if (!in_array((int)$formatted_location_id, $linked_locations) && $stock_value > 0) {
    48         // Location is not linked, so add it to linked locations
    49         $updated_terms = $linked_locations;
    50         $updated_terms[] = (int)$formatted_location_id;
    51         wp_set_object_terms($product_id, $updated_terms, 'locations-lite', false);
    52     }
    53 
    54     // Calculate total stock across all locations
    55     wcmlim_calculate_and_update_total_stock($product_id);
    56 
    57     // Stock Management
    58     manage_stock($product, $formatted_location_id, $stock_value);
    59 
    60     // Availability Management
    61     update_availability($product, $formatted_location_id, $stock_value);
    62    
    63     // Product save
    64     $product->save();
     41function multiloca_link_location_to_product_if_exists($product_id, $location_term_id){
     42    if (!term_exists($location_term_id, 'locations')) {
     43        return;
     44    }
     45    $linked_locations = wp_get_object_terms($product_id, 'locations', array('fields' => 'ids'));
     46   
     47    if (!in_array($location_term_id, $linked_locations)) {
     48        $updated_terms = array_merge($linked_locations, array($location_term_id));
     49        wp_set_object_terms($product_id, $updated_terms, 'locations', false);
     50    }
    6551}
    6652
     
    7763function wcmlim_handle_location_linking($object_id, $terms, $tt_ids, $taxonomy, $append, $old_tt_ids) {
    7864    // Only process for our taxonomy
    79     if ($taxonomy !== 'locations-lite') {
     65    if ($taxonomy !== 'locations') {
    8066        return;
    8167    }
     
    127113function manage_stock($product, $formatted_location_id, $_meta_value) {
    128114    // Get all locations once
    129     $terms = get_terms(array('taxonomy' => 'locations-lite', 'hide_empty' => false, 'parent' => 0));
     115    $terms = get_terms(array('taxonomy' => 'locations', 'hide_empty' => false, 'parent' => 0));
    130116    $available_stock_meta_key = 'wcmlim_stock_available_at_' . $formatted_location_id;
    131117   
     
    134120    // Get linked locations for the product
    135121    // This will give us the IDs of the locations linked to this product
    136     $Linked_locations = wp_get_object_terms($product->get_id(), 'locations-lite', array('fields' => 'ids'));
     122    $Linked_locations = wp_get_object_terms($product->get_id(), 'locations', array('fields' => 'ids'));
    137123    foreach ($terms as $term) {
    138124        $term_id = $term->term_id;
     
    327313   
    328314    // Get all linked locations for this product
    329     $linked_locations = wp_get_object_terms($product_id, 'locations-lite', array('fields' => 'ids'));
     315    $linked_locations = wp_get_object_terms($product_id, 'locations', array('fields' => 'ids'));
    330316   
    331317    if (empty($linked_locations)) {
     
    529515 */
    530516function wcmlim_recalculate_stock_on_location_change($object_id, $terms, $tt_ids, $taxonomy, $append, $old_tt_ids) {
    531     if ($taxonomy === 'locations-lite') {
     517    if ($taxonomy === 'locations') {
    532518        // Check if this is a product
    533519        $post_type = get_post_type($object_id);
     
    549535        'tax_query' => array(
    550536            array(
    551                 'taxonomy' => 'locations-lite',
     537                'taxonomy' => 'locations',
    552538                'operator' => 'EXISTS',
    553539            ),
  • multiloca-lite-multi-location-inventory/tags/1.1.3/multiloca-lite-multi-location-inventory.php

    r3396942 r3401784  
    33 * Plugin Name: Multiloca Lite – Multi Locations Inventory Management
    44 * Description: Manage WooCommerce product inventory by locations and location groups. Display inventory data on the frontend.
    5  * Version: 1.1.2
     5 * Version: 1.1.3
    66 * Author: Techspawn
    77 * Author URI: https://techspawn.com/
     
    120120    private function init_hooks() {
    121121        register_activation_hook(__FILE__, array($this, 'activation_check'));
     122       
     123        // Hook migration to run after taxonomies are registered
     124        add_action('init', array($this, 'maybe_run_migration'), 999);
     125    }
     126   
     127    /**
     128     * Run migration if not yet completed
     129     * This runs on every init until migration is complete
     130     */
     131    public function maybe_run_migration() {
     132        // Only run if not already migrated
     133        if (!get_option('wcmlim_taxonomy_migrated', false)) {
     134            require_once MULTILOCA_LITE_PLUGIN_PATH . 'includes/class-multiloca-lite-activator.php';
     135            Multiloca_Lite_Activator::migrate_taxonomy_from_locations_lite_to_locations();
     136        }
    122137    }
    123138
  • multiloca-lite-multi-location-inventory/tags/1.1.3/public/class-multiloca-lite-location-filter-widget.php

    r3397110 r3401784  
    4444        $title = apply_filters('widget_title', $title, $instance, $this->id_base);
    4545
     46       
    4647        // Get all locations
    4748        $locations = get_terms(array(
    48             'taxonomy' => 'locations-lite',
     49            'taxonomy' => 'locations',
    4950            'hide_empty' => false,
    5051            'orderby' => 'name',
    5152            'order' => 'ASC'
    52         ));
    53 
    54         if (empty($locations) || is_wp_error($locations)) {
     53        ));        if (empty($locations) || is_wp_error($locations)) {
    5554            return;
    5655        }
     
    128127            'tax_query' => array(
    129128                array(
    130                     'taxonomy' => 'locations-lite',
     129                    'taxonomy' => 'locations',
    131130                    'field' => 'term_id',
    132131                    'terms' => $location_id
  • multiloca-lite-multi-location-inventory/tags/1.1.3/public/class-multiloca-lite-public.php

    r3377945 r3401784  
    109109        if ($order_by === 'priority') {
    110110            return get_terms(array(
    111                 'taxonomy' => 'locations-lite',
     111                'taxonomy' => 'locations',
    112112                'hide_empty' => false,
    113113                'meta_key' => 'wcmlim_location_priority',
     
    117117        } else {
    118118            return get_terms(array(
    119                 'taxonomy' => 'locations-lite',
     119                'taxonomy' => 'locations',
    120120                'hide_empty' => false,
    121121                'orderby' => 'name',
  • multiloca-lite-multi-location-inventory/tags/1.1.3/public/class-multiloca-lite-shop-filter.php

    r3397110 r3401784  
    6565        // Add location filter to tax query
    6666        $tax_query[] = array(
    67             'taxonomy' => 'locations-lite',
     67            'taxonomy' => 'locations',
    6868            'field' => 'term_id',
    6969            'terms' => $selected_locations,
  • multiloca-lite-multi-location-inventory/tags/1.1.3/public/controller/shop/views/multiloca-card-view.php

    r3396942 r3401784  
    2828$product_id = $product->get_id();
    2929// Get linked locations for this product/variation
    30 $locations_linked = wp_get_object_terms($product_id, 'locations-lite', ['fields' => 'ids']);
     30$locations_linked = wp_get_object_terms($product_id, 'locations', ['fields' => 'ids']);
    3131
    3232// Get all locations and filter to only show linked ones if any exist
     
    3636if ($order_by === 'priority') {
    3737            $all_locations = get_terms(array(
    38                 'taxonomy' => 'locations-lite',
     38                'taxonomy' => 'locations',
    3939                'hide_empty' => false,
    4040                'meta_key' => 'wcmlim_location_priority',
     
    4444        } else {
    4545            $all_locations = get_terms(array(
    46                 'taxonomy' => 'locations-lite',
     46                'taxonomy' => 'locations',
    4747                'hide_empty' => false,
    4848                'orderby' => 'name',
  • multiloca-lite-multi-location-inventory/tags/1.1.3/public/controller/shop/views/multiloca-expanded-view.php

    r3396942 r3401784  
    2929
    3030// Get linked locations for this product/variation
    31 $locations_linked = wp_get_object_terms($product_id, 'locations-lite', ['fields' => 'ids']);
     31$locations_linked = wp_get_object_terms($product_id, 'locations', ['fields' => 'ids']);
    3232
    3333// Get all locations and filter to only show linked ones if any exist
     
    3737if ($order_by === 'priority') {
    3838            $all_locations = get_terms(array(
    39                 'taxonomy' => 'locations-lite',
     39                'taxonomy' => 'locations',
    4040                'hide_empty' => false,
    4141                'meta_key' => 'wcmlim_location_priority',
     
    4545        } else {
    4646            $all_locations = get_terms(array(
    47                 'taxonomy' => 'locations-lite',
     47                'taxonomy' => 'locations',
    4848                'hide_empty' => false,
    4949                'orderby' => 'name',
  • multiloca-lite-multi-location-inventory/tags/1.1.3/public/controller/shop/views/multiloca-list-view.php

    r3396942 r3401784  
    2929
    3030// Get linked locations for this product/variation
    31 $locations_linked = wp_get_object_terms($product_id, 'locations-lite', ['fields' => 'ids']);
     31$locations_linked = wp_get_object_terms($product_id, 'locations', ['fields' => 'ids']);
    3232
    3333// Get all locations and filter to only show linked ones if any exist
     
    3737if ($order_by === 'priority') {
    3838            $all_locations = get_terms(array(
    39                 'taxonomy' => 'locations-lite',
     39                'taxonomy' => 'locations',
    4040                'hide_empty' => false,
    4141                'meta_key' => 'wcmlim_location_priority',
     
    4545        } else {
    4646            $all_locations = get_terms(array(
    47                 'taxonomy' => 'locations-lite',
     47                'taxonomy' => 'locations',
    4848                'hide_empty' => false,
    4949                'orderby' => 'name',
  • multiloca-lite-multi-location-inventory/tags/1.1.3/public/controller/shop/views/multiloca-simple-text-view.php

    r3396942 r3401784  
    2929
    3030// Get linked locations for this product/variation
    31 $locations_linked = wp_get_object_terms($product_id, 'locations-lite', ['fields' => 'ids']);
     31$locations_linked = wp_get_object_terms($product_id, 'locations', ['fields' => 'ids']);
    3232
    3333// Get all locations and filter to only show linked ones if any exist
     
    3737if ($order_by === 'priority') {
    3838            $all_locations = get_terms(array(
    39                 'taxonomy' => 'locations-lite',
     39                'taxonomy' => 'locations',
    4040                'hide_empty' => false,
    4141                'meta_key' => 'wcmlim_location_priority',
     
    4545        } else {
    4646            $all_locations = get_terms(array(
    47                 'taxonomy' => 'locations-lite',
     47                'taxonomy' => 'locations',
    4848                'hide_empty' => false,
    4949                'orderby' => 'name',
  • multiloca-lite-multi-location-inventory/tags/1.1.3/public/controller/shop/views/multiloca-table-view.php

    r3396942 r3401784  
    2929
    3030// Get linked locations for this product/variation
    31 $locations_linked = wp_get_object_terms($product_id, 'locations-lite', ['fields' => 'ids']);
     31$locations_linked = wp_get_object_terms($product_id, 'locations', ['fields' => 'ids']);
    3232
    3333// Get all locations and filter to only show linked ones if any exist
     
    3737if ($order_by === 'priority') {
    3838            $all_locations = get_terms(array(
    39                 'taxonomy' => 'locations-lite',
     39                'taxonomy' => 'locations',
    4040                'hide_empty' => false,
    4141                'meta_key' => 'wcmlim_location_priority',
     
    4545        } else {
    4646            $all_locations = get_terms(array(
    47                 'taxonomy' => 'locations-lite',
     47                'taxonomy' => 'locations',
    4848                'hide_empty' => false,
    4949                'orderby' => 'name',
  • multiloca-lite-multi-location-inventory/tags/1.1.3/readme.txt

    r3399138 r3401784  
    55Tested up to: 6.8
    66Requires PHP: 7.0
    7 Stable tag: 1.1.2
     7Stable tag: 1.1.3
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
  • multiloca-lite-multi-location-inventory/tags/1.1.3/uninstall.php

    r3396942 r3401784  
    3030    'wcmlim_listing_preset_location',
    3131    'wcmlim_enable_default_location',
    32     'wcmlim_sync_stock_between_locations'
     32    'wcmlim_sync_stock_between_locations',
     33    'wcmlim_taxonomy_migrated' // Migration flag
    3334);
    3435
  • multiloca-lite-multi-location-inventory/trunk/admin/class-multiloca-lite-admin.php

    r3396942 r3401784  
    3838        // Load custom inventory fields
    3939        require_once MULTILOCA_LITE_PLUGIN_PATH . 'admin/partials/multiloca-lite-custom-inventory-fields.php';
    40        
    41         // Add order field to location taxonomy
    42         add_action('locations_add_form_fields', array($this, 'add_location_order_field'));
    43         add_action('locations_edit_form_fields', array($this, 'edit_location_order_field'), 10, 2);
    44         add_action('created_locations', array($this, 'save_location_order_field'));
    45         add_action('edited_locations', array($this, 'save_location_order_field'));
    4640
    4741        add_filter('parent_file', array($this, 'wcmlim_lite_submenu_highlight'));
     
    6155        );
    6256        // Only include on our settings pages and taxonomy pages
    63         if ($_GET['taxonomy'] === 'locations-lite' || strpos($hook, 'multiloca-lite-settings') !== false) {
     57        if ($_GET['taxonomy'] === 'locations' || strpos($hook, 'multiloca-lite-settings') !== false) {
    6458           
    6559           
     
    149143            __('Locations', 'multiloca-lite-multi-location-inventory'),
    150144            'manage_options',
    151             'edit-tags.php?taxonomy=locations-lite&post_type=product',
     145            'edit-tags.php?taxonomy=locations&post_type=product',
    152146            null
    153147        );
     
    614608        global $current_screen;
    615609        $taxonomy = $current_screen->taxonomy;
    616         if ($taxonomy == 'locations-lite') {
     610        if ($taxonomy == 'locations') {
    617611            $parent_file = 'multiloca-lite-settings';
    618612        }
     
    621615
    622616    public function wcmlim_lite_highlight_submenu($submenu_file) {
    623         $locations = 'edit-tags.php?taxonomy=locations-lite&post_type=product';
     617        $locations = 'edit-tags.php?taxonomy=locations&post_type=product';
    624618
    625619        if (esc_html($locations) == $submenu_file) {
    626             return 'edit-tags.php?taxonomy=locations-lite&post_type=product';
     620            return 'edit-tags.php?taxonomy=locations&post_type=product';
    627621        }
    628622        return $submenu_file;
  • multiloca-lite-multi-location-inventory/trunk/admin/js/multiloca-lite-admin.js

    r3336945 r3401784  
    1111
    1212        function validate_add_location() {
    13             if ($(".taxonomy-locations-lite").length > 0) {
     13            if ($(".taxonomy-locations").length > 0) {
    1414
    1515            var tag_name = $('#tag-name').val();
  • multiloca-lite-multi-location-inventory/trunk/admin/js/multiloca-lite-product-edit.js

    r3374381 r3401784  
    2727            setTimeout(function() {
    2828                // If locations are checked, suggest enabling stock management
    29                 if ($('#taxonomy-locations-lite input:checked').length > 0 && !$('#_manage_stock').is(':checked')) {
     29                if ($('#taxonomy-locations input:checked').length > 0 && !$('#_manage_stock').is(':checked')) {
    3030                    log('Locations selected but stock management not enabled');
    3131                    // Add a notice above the stock management field
     
    4444        function getSelectedLocationIds() {
    4545            const selectedIds = [];
    46             $('#taxonomy-locations-lite input:checked').each(function() {
     46           
     47            // Check multiple possible selectors for the taxonomy checkboxes
     48            const $checkboxes = $('#taxonomy-locations input[type="checkbox"]:checked, ' +
     49                                 '#locationsdiv input[type="checkbox"]:checked, ' +
     50                                 '.categorydiv[id*="locations"] input[type="checkbox"]:checked');
     51           
     52            $checkboxes.each(function() {
    4753                const id = $(this).val();
    48                 if (id) {
     54                // Skip the 0 value checkbox (usually "All" checkbox)
     55                if (id && id !== '0') {
    4956                    selectedIds.push(id);
    5057                }
     
    216223        // For new products, select all locations
    217224        if (window.location.href.indexOf('post-new.php') !== -1) {
    218             $('#taxonomy-locations-lite input[type="checkbox"]').prop('checked', true);
     225            $('#taxonomy-locations input[type="checkbox"]').prop('checked', true);
    219226            log('New product - checking all location boxes');
    220227        }
     
    276283
    277284        // Listen for changes to checkboxes in the locations taxonomy box
    278         $(document).on('change', '#taxonomy-locations-lite input[type="checkbox"]', function() {
     285        $(document).on('change', '#taxonomy-locations input[type="checkbox"]', function() {
    279286            log('Location checkbox changed');
    280287            updateLocationInventoryFields();
     
    282289
    283290        // Handle "Select All" and "Clear" actions
    284         $(document).on('click', '#locations-lite-all', function() {
     291        $(document).on('click', '#locations-all', function() {
    285292            log('Select All clicked');
    286293            setTimeout(updateLocationInventoryFields, 100);
    287294        });
    288295       
    289         $(document).on('click', '#locations-lite-none', function() {
     296        $(document).on('click', '#locations-none', function() {
    290297            log('Clear clicked');
    291298            setTimeout(updateLocationInventoryFields, 100);
     
    293300       
    294301        // Handle Most Used tab clicks
    295         $(document).on('click', '#locations-lite-pop', function() {
     302        $(document).on('click', '#locations-pop', function() {
    296303            log('Most Used clicked');
    297304            setTimeout(updateLocationInventoryFields, 100);
     
    304311                typeof settings.data === 'string' &&
    305312                (settings.data.indexOf('action=add-tag') !== -1 ||
    306                  settings.data.indexOf('action=add-locations-lite') !== -1 ||
    307                  settings.data.indexOf('taxonomy=locations-lite') !== -1)) {
     313                 settings.data.indexOf('action=add-locations') !== -1 ||
     314                 settings.data.indexOf('taxonomy=locations') !== -1)) {
    308315                log('AJAX completed - taxonomy updated');
    309316                setTimeout(updateLocationInventoryFields, 100);
  • multiloca-lite-multi-location-inventory/trunk/admin/partials/multiloca-lite-custom-inventory-fields.php

    r3377945 r3401784  
    4848        }
    4949
    50         // Get the parent product ID for location linking
     50       
     51        // Get parent product for location linking
    5152        $variation = wc_get_product($variation_id);
    5253        if (!$variation || !$variation->is_type('variation')) {
     
    5657       
    5758        $parent_id = $variation->get_parent_id();
    58         $locations_linked = wp_get_object_terms($parent_id, 'locations-lite', ['fields' => 'ids']);
    59        
    60         // Get display settings
     59        $locations_linked = wp_get_object_terms($parent_id, 'locations', ['fields' => 'ids']);        // Get display settings
    6160        $heading_text = get_option('wcmlim_txt_in_fdiv', esc_html__('Location Availability', 'multiloca-lite-multi-location-inventory'));
    6261        $instock_text = get_option('wcmlim_txt_in_btn_instock', esc_html__('In Stock', 'multiloca-lite-multi-location-inventory'));
     
    7877            if ($order_by === 'priority') {
    7978                $locations = get_terms(array(
    80                     'taxonomy' => 'locations-lite',
     79                    'taxonomy' => 'locations',
    8180                    'hide_empty' => false,
    8281                    'include' => $locations_linked,
     
    8786            } else {
    8887                $locations = get_terms(array(
    89                     'taxonomy' => 'locations-lite',
     88                    'taxonomy' => 'locations',
    9089                    'hide_empty' => false,
    9190                    'include' => $locations_linked,
     
    582581       
    583582        // Get all available locations
    584         $locations = get_terms(array('taxonomy' => 'locations-lite', 'hide_empty' => false));
     583        $locations = get_terms(array('taxonomy' => 'locations', 'hide_empty' => false));
    585584       
    586585        if (empty($locations)) {
     
    611610                // Check for child locations
    612611                $child_locations = get_terms(array(
    613                     'taxonomy' => 'locations-lite',
     612                    'taxonomy' => 'locations',
    614613                    'hide_empty' => false,
    615614                    'parent' => $location->term_id,
     
    659658       
    660659        // Get linked/selected locations
    661         $locations_linked = wp_get_object_terms($product_id, 'locations-lite', ['fields' => 'ids']);
     660        $locations_linked = wp_get_object_terms($product_id, 'locations', ['fields' => 'ids']);
    662661       
    663662        if (empty($locations_linked)) {
     
    672671        // Get all locations and filter for the linked ones
    673672        $locations = get_terms(array(
    674             'taxonomy' => 'locations-lite',
     673            'taxonomy' => 'locations',
    675674            'hide_empty' => false,
    676675            'include' => $locations_linked // Only include linked locations
     
    723722       
    724723        // Get all available locations
    725         $locations = get_terms(array('taxonomy' => 'locations-lite', 'hide_empty' => false));
     724        $locations = get_terms(array('taxonomy' => 'locations', 'hide_empty' => false));
    726725       
    727726        if (!empty($locations)) {
     
    768767       
    769768        // Get linked/selected locations from the parent product
    770         $locations_linked = wp_get_object_terms($parent_id, 'locations-lite', ['fields' => 'ids']);
     769        $locations_linked = wp_get_object_terms($parent_id, 'locations', ['fields' => 'ids']);
    771770       
    772771        if (empty($locations_linked)) {
     
    782781        // Get all locations to loop through
    783782        $all_locations = get_terms(array(
    784             'taxonomy' => 'locations-lite',
     783            'taxonomy' => 'locations',
    785784            'hide_empty' => false
    786785        ));
     
    806805                    // Also update the parent product's location link if needed
    807806                    if (!in_array($location_id, $locations_linked)) {
    808                         wp_set_object_terms($parent_id, (int)$location_id, 'locations-lite', true);
     807                        wp_set_object_terms($parent_id, (int)$location_id, 'locations', true);
    809808                    }
    810809                } else {
  • multiloca-lite-multi-location-inventory/trunk/includes/class-multiloca-lite-activator.php

    r3396942 r3401784  
    6161        flush_rewrite_rules();
    6262    }
     63   
     64    /**
     65     * Run migration after plugin is fully loaded
     66     * This is hooked to 'init' with high priority to ensure taxonomies are registered
     67     */
     68    public static function run_migration_on_init() {
     69        // Only run if not already migrated
     70        if (!get_option('wcmlim_taxonomy_migrated', false)) {
     71            self::migrate_taxonomy_from_locations_lite_to_locations();
     72        }
     73    }
     74   
     75    /**
     76     * Migrate taxonomy data from 'locations-lite' to 'locations'
     77     * This runs only once to preserve existing user data during the taxonomy rename
     78     */
     79    public static function migrate_taxonomy_from_locations_lite_to_locations() {
     80        // Check if migration has already been completed
     81        if (get_option('wcmlim_taxonomy_migrated', false)) {
     82            return; // Migration already done, skip
     83        }
     84       
     85        // Check if new taxonomy exists
     86        if (!taxonomy_exists('locations')) {
     87            // New taxonomy not registered yet, will retry on next init
     88            return;
     89        }
     90       
     91        // Temporarily register the old taxonomy to access existing data
     92        // This is needed because we removed it from the main codebase
     93        if (!taxonomy_exists('locations-lite')) {
     94            register_taxonomy('locations-lite', 'product', array(
     95                'hierarchical' => true,
     96                'public' => false,
     97                'show_ui' => false,
     98                'show_in_rest' => false,
     99            ));
     100        }
     101       
     102        // Get all terms from the old taxonomy
     103        $old_terms = get_terms(array(
     104            'taxonomy' => 'locations-lite',
     105            'hide_empty' => false,
     106            'orderby' => 'term_id',
     107            'order' => 'ASC',
     108        ));
     109       
     110        if (empty($old_terms) || is_wp_error($old_terms)) {
     111            // No terms to migrate, mark as done
     112            update_option('wcmlim_taxonomy_migrated', true);
     113            return;
     114        }
     115       
     116        // Array to map old term IDs to new term IDs
     117        $term_id_mapping = array();
     118        // Array to track which terms were newly created (vs already existed)
     119        $newly_created_terms = array();
     120       
     121        // First pass: Create all terms in the new taxonomy
     122        foreach ($old_terms as $old_term) {
     123            // Check if term already exists in new taxonomy
     124            $existing_term = term_exists($old_term->slug, 'locations');
     125           
     126            if ($existing_term) {
     127                // Term already exists - skip it to preserve manually created data
     128                // Don't add to mapping, so it won't be processed in later passes
     129                continue;
     130            } else {
     131                // Create new term in 'locations' taxonomy
     132                $new_term = wp_insert_term(
     133                    $old_term->name,
     134                    'locations',
     135                    array(
     136                        'description' => $old_term->description,
     137                        'slug' => $old_term->slug,
     138                        'parent' => 0, // We'll set parent in second pass
     139                    )
     140                );
     141               
     142                if (!is_wp_error($new_term)) {
     143                    $term_id_mapping[$old_term->term_id] = $new_term['term_id'];
     144                    $newly_created_terms[] = $new_term['term_id'];
     145                   
     146                    // Copy all term meta from old term to new term
     147                    self::copy_term_meta($old_term->term_id, $new_term['term_id']);
     148                }
     149            }
     150        }
     151       
     152        // Second pass: Set up parent-child relationships
     153        foreach ($old_terms as $old_term) {
     154            if ($old_term->parent > 0 && isset($term_id_mapping[$old_term->term_id]) && isset($term_id_mapping[$old_term->parent])) {
     155                wp_update_term(
     156                    $term_id_mapping[$old_term->term_id],
     157                    'locations',
     158                    array('parent' => $term_id_mapping[$old_term->parent])
     159                );
     160            }
     161        }
     162       
     163        // Third pass: Migrate product-term relationships
     164        global $wpdb;
     165       
     166        // Get all product IDs that have the old taxonomy terms
     167        $product_ids = $wpdb->get_col($wpdb->prepare(
     168            "SELECT DISTINCT object_id
     169             FROM {$wpdb->term_relationships} tr
     170             INNER JOIN {$wpdb->term_taxonomy} tt ON tr.term_taxonomy_id = tt.term_taxonomy_id
     171             WHERE tt.taxonomy = %s",
     172            'locations-lite'
     173        ));
     174       
     175        foreach ($product_ids as $product_id) {
     176            // Get old terms for this product
     177            $old_product_terms = wp_get_object_terms($product_id, 'locations-lite', array('fields' => 'ids'));
     178           
     179            if (!empty($old_product_terms) && !is_wp_error($old_product_terms)) {
     180                // Map old term IDs to new term IDs
     181                $new_term_ids = array();
     182                foreach ($old_product_terms as $old_term_id) {
     183                    if (isset($term_id_mapping[$old_term_id])) {
     184                        $new_term_ids[] = $term_id_mapping[$old_term_id];
     185                    }
     186                }
     187               
     188                // Assign new terms to product - APPEND to existing relationships
     189                if (!empty($new_term_ids)) {
     190                    wp_set_object_terms($product_id, $new_term_ids, 'locations', true);
     191                }
     192            }
     193           
     194            // Migrate post meta: wcmlim_stock_at_{term_id} and wcmlim_product_availability_at_{term_id}
     195            // Only copy for newly created terms to preserve manual data
     196            foreach ($term_id_mapping as $old_term_id => $new_term_id) {
     197                // Skip if this term already existed (not in newly created list)
     198                if (!in_array($new_term_id, $newly_created_terms)) {
     199                    continue;
     200                }
     201               
     202                // Copy stock meta
     203                $stock_meta_key_old = 'wcmlim_stock_at_' . $old_term_id;
     204                $stock_meta_key_new = 'wcmlim_stock_at_' . $new_term_id;
     205                $stock_value = get_post_meta($product_id, $stock_meta_key_old, true);
     206               
     207                if ($stock_value !== '') {
     208                    update_post_meta($product_id, $stock_meta_key_new, $stock_value);
     209                }
     210               
     211                // Copy availability meta
     212                $avail_meta_key_old = 'wcmlim_product_availability_at_' . $old_term_id;
     213                $avail_meta_key_new = 'wcmlim_product_availability_at_' . $new_term_id;
     214                $avail_value = get_post_meta($product_id, $avail_meta_key_old, true);
     215               
     216                if ($avail_value !== '') {
     217                    update_post_meta($product_id, $avail_meta_key_new, $avail_value);
     218                }
     219            }
     220        }
     221       
     222        // Mark migration as complete
     223        update_option('wcmlim_taxonomy_migrated', true);
     224    }
     225   
     226    /**
     227     * Copy all term meta from old term to new term
     228     */
     229    private static function copy_term_meta($old_term_id, $new_term_id) {
     230        // List of all term meta keys used by the plugin
     231        $meta_keys = array(
     232            'wcmlim_street_address',
     233            'wcmlim_city',
     234            'wcmlim_state',
     235            'wcmlim_postcode',
     236            'wcmlim_country_state',
     237            'wcmlim_email',
     238            'wcmlim_phone',
     239            'wcmlim_business_hours',
     240            'wcmlim_location_priority',
     241            'wcmlim_start_time',
     242            'wcmlim_end_time',
     243            'wcmlim_street_number',
     244            'wcmlim_route',
     245            'wcmlim_locality',
     246            'wcmlim_administrative_area_level_1',
     247            'wcmlim_postal_code',
     248            'wcmlim_country',
     249            'wcmlim_lat',
     250            'wcmlim_lng',
     251            'wcmlim_linked_users',
     252            'wcmlim_locator',
     253        );
     254       
     255        foreach ($meta_keys as $meta_key) {
     256            $meta_value = get_term_meta($old_term_id, $meta_key, true);
     257            if ($meta_value !== '') {
     258                update_term_meta($new_term_id, $meta_key, $meta_value);
     259            }
     260        }
     261    }
    63262}
  • multiloca-lite-multi-location-inventory/trunk/includes/class-multiloca-lite-cart-location.php

    r3377945 r3401784  
    417417       
    418418        // Get all linked locations for this product
    419         $linked_locations = wp_get_object_terms($product_id, 'locations-lite', array('fields' => 'ids'));
     419        $linked_locations = wp_get_object_terms($product_id, 'locations', array('fields' => 'ids'));
    420420       
    421421        if (empty($linked_locations)) {
  • multiloca-lite-multi-location-inventory/trunk/includes/class-multiloca-lite-taxonomy.php

    r3396942 r3401784  
    2020       
    2121        // Add custom fields to location taxonomy
    22         add_action('locations-lite_add_form_fields', array($this, 'add_taxonomy_fields'), 10);
    23         add_action('locations-lite_edit_form_fields', array($this, 'edit_taxonomy_fields'), 10, 2);
    24         add_action('created_locations-lite', array($this, 'save_taxonomy_fields'), 10, 2);
    25         add_action('edited_locations-lite', array($this, 'save_taxonomy_fields'), 10, 2);
     22        add_action('locations_add_form_fields', array($this, 'add_taxonomy_fields'), 10);
     23        add_action('locations_edit_form_fields', array($this, 'edit_taxonomy_fields'), 10, 2);
     24        add_action('created_locations', array($this, 'save_taxonomy_fields'), 10, 2);
     25        add_action('edited_locations', array($this, 'save_taxonomy_fields'), 10, 2);
    2626    }
    2727
     
    7070    );
    7171   
    72     register_taxonomy('locations-lite', 'product', $args);
    73 
    74     register_term_meta('locations-lite', 'wcmlim_street_address', ['show_in_rest' => true]);
    75     register_term_meta('locations-lite', 'wcmlim_city', ['show_in_rest' => true]);
    76     register_term_meta('locations-lite', 'wcmlim_state', ['show_in_rest' => true]);
    77     register_term_meta('locations-lite', 'wcmlim_postcode', ['show_in_rest' => true]);
    78     register_term_meta('locations-lite', 'wcmlim_country_state', ['show_in_rest' => true]);
    79     register_term_meta('locations-lite', 'wcmlim_email', ['show_in_rest' => true]);
    80     register_term_meta('locations-lite', 'wcmlim_phone', ['show_in_rest' => true]);
    81     register_term_meta('locations-lite', 'wcmlim_business_hours', ['show_in_rest' => true]);
    82     register_term_meta('locations-lite', 'wcmlim_location_priority', ['show_in_rest' => true]);
    83     register_term_meta('locations-lite', 'wcmlim_start_time', ['show_in_rest' => true]);
    84     register_term_meta('locations-lite', 'wcmlim_end_time', ['show_in_rest' => true]);
    85     register_term_meta('locations-lite', 'wcmlim_street_number', ['show_in_rest' => true]);
    86     register_term_meta('locations-lite', 'wcmlim_route', ['show_in_rest' => true]);
    87     register_term_meta('locations-lite', 'wcmlim_locality', ['show_in_rest' => true]);
    88     register_term_meta('locations-lite', 'wcmlim_administrative_area_level_1', ['show_in_rest' => true]);
    89     register_term_meta('locations-lite', 'wcmlim_postal_code', ['show_in_rest' => true]);
    90     register_term_meta('locations-lite', 'wcmlim_country', ['show_in_rest' => true]);
    91     register_taxonomy_for_object_type('locations-lite', 'product');
    92     register_term_meta('locations-lite', 'wcmlim_lat', ['show_in_rest' => true]);
    93     register_term_meta('locations-lite', 'wcmlim_lng', ['show_in_rest' => true]);
    94     register_term_meta('locations-lite', 'wcmlim_linked_users', ['show_in_rest' => true]);
     72    register_taxonomy('locations', 'product', $args);
     73
     74    register_term_meta('locations', 'wcmlim_street_address', ['show_in_rest' => true]);
     75    register_term_meta('locations', 'wcmlim_city', ['show_in_rest' => true]);
     76    register_term_meta('locations', 'wcmlim_state', ['show_in_rest' => true]);
     77    register_term_meta('locations', 'wcmlim_postcode', ['show_in_rest' => true]);
     78    register_term_meta('locations', 'wcmlim_country_state', ['show_in_rest' => true]);
     79    register_term_meta('locations', 'wcmlim_email', ['show_in_rest' => true]);
     80    register_term_meta('locations', 'wcmlim_phone', ['show_in_rest' => true]);
     81    register_term_meta('locations', 'wcmlim_business_hours', ['show_in_rest' => true]);
     82    register_term_meta('locations', 'wcmlim_location_priority', ['show_in_rest' => true]);
     83    register_term_meta('locations', 'wcmlim_start_time', ['show_in_rest' => true]);
     84    register_term_meta('locations', 'wcmlim_end_time', ['show_in_rest' => true]);
     85    register_term_meta('locations', 'wcmlim_street_number', ['show_in_rest' => true]);
     86    register_term_meta('locations', 'wcmlim_route', ['show_in_rest' => true]);
     87    register_term_meta('locations', 'wcmlim_locality', ['show_in_rest' => true]);
     88    register_term_meta('locations', 'wcmlim_administrative_area_level_1', ['show_in_rest' => true]);
     89    register_term_meta('locations', 'wcmlim_postal_code', ['show_in_rest' => true]);
     90    register_term_meta('locations', 'wcmlim_country', ['show_in_rest' => true]);
     91    register_taxonomy_for_object_type('locations', 'product');
     92    register_term_meta('locations', 'wcmlim_lat', ['show_in_rest' => true]);
     93    register_term_meta('locations', 'wcmlim_lng', ['show_in_rest' => true]);
     94    register_term_meta('locations', 'wcmlim_linked_users', ['show_in_rest' => true]);
    9595
    9696    /**start Location Group */
    97     register_term_meta('locations-lite', 'wcmlim_locator', ['show_in_rest' => true]);
     97    register_term_meta('locations', 'wcmlim_locator', ['show_in_rest' => true]);
    9898    /** End Location Group */
    9999  }
  • multiloca-lite-multi-location-inventory/trunk/includes/helper/multiloca-lite-inventory-helper.php

    r3377945 r3401784  
    1919add_action('init', 'wcmlim_init_inventory_hooks');
    2020
     21/**
     22 * Update inventory data when post meta is updated
     23 * This is called when location stock values change
     24 */
     25function wcmlim_update_inventory_data_addon($meta_id, $object_id, $meta_key, $meta_value) {
     26    // Only process for product posts
     27    if (get_post_type($object_id) !== 'product') {
     28        return;
     29    }
     30   
     31    // Check if this is a location stock meta key
     32    if (strpos($meta_key, 'wcmlim_stock_at_') !== 0) {
     33        return;
     34    }
     35   
     36    // Recalculate total stock for this product
     37    wcmlim_calculate_and_update_total_stock($object_id);
     38}
     39
    2140//This function will update the total stock count via external methods including importers & woocommerce API
    22 function wcmlim_update_inventory_data_addon($meta_id, $object_id, $meta_key, $_meta_value) {
    23     global $wpdb;
    24 
    25     // Check if we should skip calculations during order processing
    26     if (apply_filters('wcmlim_skip_stock_calculation', false)) {
    27         return;
    28     }
    29 
    30     // Check if the meta key relates to stock at a specific location
    31     if (!str_contains($meta_key, 'wcmlim_stock_at_')) {
    32         return;
    33     }
    34 
    35     $formatted_location_id = preg_replace('/[^0-9]/', '', $meta_key);
    36     $product_id = $object_id;
    37     $product = wc_get_product($product_id);
    38 
    39     if (!$product) {
    40         return;
    41     }
    42 
    43     $stock_value = (int)$_meta_value; // Convert to integer
    44 
    45     // Check if this location is linked to the product
    46     $linked_locations = wp_get_object_terms($product_id, 'locations-lite', array('fields' => 'ids'));
    47     if (!in_array((int)$formatted_location_id, $linked_locations) && $stock_value > 0) {
    48         // Location is not linked, so add it to linked locations
    49         $updated_terms = $linked_locations;
    50         $updated_terms[] = (int)$formatted_location_id;
    51         wp_set_object_terms($product_id, $updated_terms, 'locations-lite', false);
    52     }
    53 
    54     // Calculate total stock across all locations
    55     wcmlim_calculate_and_update_total_stock($product_id);
    56 
    57     // Stock Management
    58     manage_stock($product, $formatted_location_id, $stock_value);
    59 
    60     // Availability Management
    61     update_availability($product, $formatted_location_id, $stock_value);
    62    
    63     // Product save
    64     $product->save();
     41function multiloca_link_location_to_product_if_exists($product_id, $location_term_id){
     42    if (!term_exists($location_term_id, 'locations')) {
     43        return;
     44    }
     45    $linked_locations = wp_get_object_terms($product_id, 'locations', array('fields' => 'ids'));
     46   
     47    if (!in_array($location_term_id, $linked_locations)) {
     48        $updated_terms = array_merge($linked_locations, array($location_term_id));
     49        wp_set_object_terms($product_id, $updated_terms, 'locations', false);
     50    }
    6551}
    6652
     
    7763function wcmlim_handle_location_linking($object_id, $terms, $tt_ids, $taxonomy, $append, $old_tt_ids) {
    7864    // Only process for our taxonomy
    79     if ($taxonomy !== 'locations-lite') {
     65    if ($taxonomy !== 'locations') {
    8066        return;
    8167    }
     
    127113function manage_stock($product, $formatted_location_id, $_meta_value) {
    128114    // Get all locations once
    129     $terms = get_terms(array('taxonomy' => 'locations-lite', 'hide_empty' => false, 'parent' => 0));
     115    $terms = get_terms(array('taxonomy' => 'locations', 'hide_empty' => false, 'parent' => 0));
    130116    $available_stock_meta_key = 'wcmlim_stock_available_at_' . $formatted_location_id;
    131117   
     
    134120    // Get linked locations for the product
    135121    // This will give us the IDs of the locations linked to this product
    136     $Linked_locations = wp_get_object_terms($product->get_id(), 'locations-lite', array('fields' => 'ids'));
     122    $Linked_locations = wp_get_object_terms($product->get_id(), 'locations', array('fields' => 'ids'));
    137123    foreach ($terms as $term) {
    138124        $term_id = $term->term_id;
     
    327313   
    328314    // Get all linked locations for this product
    329     $linked_locations = wp_get_object_terms($product_id, 'locations-lite', array('fields' => 'ids'));
     315    $linked_locations = wp_get_object_terms($product_id, 'locations', array('fields' => 'ids'));
    330316   
    331317    if (empty($linked_locations)) {
     
    529515 */
    530516function wcmlim_recalculate_stock_on_location_change($object_id, $terms, $tt_ids, $taxonomy, $append, $old_tt_ids) {
    531     if ($taxonomy === 'locations-lite') {
     517    if ($taxonomy === 'locations') {
    532518        // Check if this is a product
    533519        $post_type = get_post_type($object_id);
     
    549535        'tax_query' => array(
    550536            array(
    551                 'taxonomy' => 'locations-lite',
     537                'taxonomy' => 'locations',
    552538                'operator' => 'EXISTS',
    553539            ),
  • multiloca-lite-multi-location-inventory/trunk/multiloca-lite-multi-location-inventory.php

    r3396942 r3401784  
    33 * Plugin Name: Multiloca Lite – Multi Locations Inventory Management
    44 * Description: Manage WooCommerce product inventory by locations and location groups. Display inventory data on the frontend.
    5  * Version: 1.1.2
     5 * Version: 1.1.3
    66 * Author: Techspawn
    77 * Author URI: https://techspawn.com/
     
    120120    private function init_hooks() {
    121121        register_activation_hook(__FILE__, array($this, 'activation_check'));
     122       
     123        // Hook migration to run after taxonomies are registered
     124        add_action('init', array($this, 'maybe_run_migration'), 999);
     125    }
     126   
     127    /**
     128     * Run migration if not yet completed
     129     * This runs on every init until migration is complete
     130     */
     131    public function maybe_run_migration() {
     132        // Only run if not already migrated
     133        if (!get_option('wcmlim_taxonomy_migrated', false)) {
     134            require_once MULTILOCA_LITE_PLUGIN_PATH . 'includes/class-multiloca-lite-activator.php';
     135            Multiloca_Lite_Activator::migrate_taxonomy_from_locations_lite_to_locations();
     136        }
    122137    }
    123138
  • multiloca-lite-multi-location-inventory/trunk/public/class-multiloca-lite-location-filter-widget.php

    r3397110 r3401784  
    4444        $title = apply_filters('widget_title', $title, $instance, $this->id_base);
    4545
     46       
    4647        // Get all locations
    4748        $locations = get_terms(array(
    48             'taxonomy' => 'locations-lite',
     49            'taxonomy' => 'locations',
    4950            'hide_empty' => false,
    5051            'orderby' => 'name',
    5152            'order' => 'ASC'
    52         ));
    53 
    54         if (empty($locations) || is_wp_error($locations)) {
     53        ));        if (empty($locations) || is_wp_error($locations)) {
    5554            return;
    5655        }
     
    128127            'tax_query' => array(
    129128                array(
    130                     'taxonomy' => 'locations-lite',
     129                    'taxonomy' => 'locations',
    131130                    'field' => 'term_id',
    132131                    'terms' => $location_id
  • multiloca-lite-multi-location-inventory/trunk/public/class-multiloca-lite-public.php

    r3377945 r3401784  
    109109        if ($order_by === 'priority') {
    110110            return get_terms(array(
    111                 'taxonomy' => 'locations-lite',
     111                'taxonomy' => 'locations',
    112112                'hide_empty' => false,
    113113                'meta_key' => 'wcmlim_location_priority',
     
    117117        } else {
    118118            return get_terms(array(
    119                 'taxonomy' => 'locations-lite',
     119                'taxonomy' => 'locations',
    120120                'hide_empty' => false,
    121121                'orderby' => 'name',
  • multiloca-lite-multi-location-inventory/trunk/public/class-multiloca-lite-shop-filter.php

    r3397110 r3401784  
    6565        // Add location filter to tax query
    6666        $tax_query[] = array(
    67             'taxonomy' => 'locations-lite',
     67            'taxonomy' => 'locations',
    6868            'field' => 'term_id',
    6969            'terms' => $selected_locations,
  • multiloca-lite-multi-location-inventory/trunk/public/controller/shop/views/multiloca-card-view.php

    r3396942 r3401784  
    2828$product_id = $product->get_id();
    2929// Get linked locations for this product/variation
    30 $locations_linked = wp_get_object_terms($product_id, 'locations-lite', ['fields' => 'ids']);
     30$locations_linked = wp_get_object_terms($product_id, 'locations', ['fields' => 'ids']);
    3131
    3232// Get all locations and filter to only show linked ones if any exist
     
    3636if ($order_by === 'priority') {
    3737            $all_locations = get_terms(array(
    38                 'taxonomy' => 'locations-lite',
     38                'taxonomy' => 'locations',
    3939                'hide_empty' => false,
    4040                'meta_key' => 'wcmlim_location_priority',
     
    4444        } else {
    4545            $all_locations = get_terms(array(
    46                 'taxonomy' => 'locations-lite',
     46                'taxonomy' => 'locations',
    4747                'hide_empty' => false,
    4848                'orderby' => 'name',
  • multiloca-lite-multi-location-inventory/trunk/public/controller/shop/views/multiloca-expanded-view.php

    r3396942 r3401784  
    2929
    3030// Get linked locations for this product/variation
    31 $locations_linked = wp_get_object_terms($product_id, 'locations-lite', ['fields' => 'ids']);
     31$locations_linked = wp_get_object_terms($product_id, 'locations', ['fields' => 'ids']);
    3232
    3333// Get all locations and filter to only show linked ones if any exist
     
    3737if ($order_by === 'priority') {
    3838            $all_locations = get_terms(array(
    39                 'taxonomy' => 'locations-lite',
     39                'taxonomy' => 'locations',
    4040                'hide_empty' => false,
    4141                'meta_key' => 'wcmlim_location_priority',
     
    4545        } else {
    4646            $all_locations = get_terms(array(
    47                 'taxonomy' => 'locations-lite',
     47                'taxonomy' => 'locations',
    4848                'hide_empty' => false,
    4949                'orderby' => 'name',
  • multiloca-lite-multi-location-inventory/trunk/public/controller/shop/views/multiloca-list-view.php

    r3396942 r3401784  
    2929
    3030// Get linked locations for this product/variation
    31 $locations_linked = wp_get_object_terms($product_id, 'locations-lite', ['fields' => 'ids']);
     31$locations_linked = wp_get_object_terms($product_id, 'locations', ['fields' => 'ids']);
    3232
    3333// Get all locations and filter to only show linked ones if any exist
     
    3737if ($order_by === 'priority') {
    3838            $all_locations = get_terms(array(
    39                 'taxonomy' => 'locations-lite',
     39                'taxonomy' => 'locations',
    4040                'hide_empty' => false,
    4141                'meta_key' => 'wcmlim_location_priority',
     
    4545        } else {
    4646            $all_locations = get_terms(array(
    47                 'taxonomy' => 'locations-lite',
     47                'taxonomy' => 'locations',
    4848                'hide_empty' => false,
    4949                'orderby' => 'name',
  • multiloca-lite-multi-location-inventory/trunk/public/controller/shop/views/multiloca-simple-text-view.php

    r3396942 r3401784  
    2929
    3030// Get linked locations for this product/variation
    31 $locations_linked = wp_get_object_terms($product_id, 'locations-lite', ['fields' => 'ids']);
     31$locations_linked = wp_get_object_terms($product_id, 'locations', ['fields' => 'ids']);
    3232
    3333// Get all locations and filter to only show linked ones if any exist
     
    3737if ($order_by === 'priority') {
    3838            $all_locations = get_terms(array(
    39                 'taxonomy' => 'locations-lite',
     39                'taxonomy' => 'locations',
    4040                'hide_empty' => false,
    4141                'meta_key' => 'wcmlim_location_priority',
     
    4545        } else {
    4646            $all_locations = get_terms(array(
    47                 'taxonomy' => 'locations-lite',
     47                'taxonomy' => 'locations',
    4848                'hide_empty' => false,
    4949                'orderby' => 'name',
  • multiloca-lite-multi-location-inventory/trunk/public/controller/shop/views/multiloca-table-view.php

    r3396942 r3401784  
    2929
    3030// Get linked locations for this product/variation
    31 $locations_linked = wp_get_object_terms($product_id, 'locations-lite', ['fields' => 'ids']);
     31$locations_linked = wp_get_object_terms($product_id, 'locations', ['fields' => 'ids']);
    3232
    3333// Get all locations and filter to only show linked ones if any exist
     
    3737if ($order_by === 'priority') {
    3838            $all_locations = get_terms(array(
    39                 'taxonomy' => 'locations-lite',
     39                'taxonomy' => 'locations',
    4040                'hide_empty' => false,
    4141                'meta_key' => 'wcmlim_location_priority',
     
    4545        } else {
    4646            $all_locations = get_terms(array(
    47                 'taxonomy' => 'locations-lite',
     47                'taxonomy' => 'locations',
    4848                'hide_empty' => false,
    4949                'orderby' => 'name',
  • multiloca-lite-multi-location-inventory/trunk/readme.txt

    r3399138 r3401784  
    55Tested up to: 6.8
    66Requires PHP: 7.0
    7 Stable tag: 1.1.2
     7Stable tag: 1.1.3
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
  • multiloca-lite-multi-location-inventory/trunk/uninstall.php

    r3396942 r3401784  
    3030    'wcmlim_listing_preset_location',
    3131    'wcmlim_enable_default_location',
    32     'wcmlim_sync_stock_between_locations'
     32    'wcmlim_sync_stock_between_locations',
     33    'wcmlim_taxonomy_migrated' // Migration flag
    3334);
    3435
Note: See TracChangeset for help on using the changeset viewer.