Changeset 3401784
- Timestamp:
- 11/24/2025 11:16:08 AM (4 months ago)
- Location:
- multiloca-lite-multi-location-inventory
- Files:
-
- 38 edited
- 1 copied
-
tags/1.1.3 (copied) (copied from multiloca-lite-multi-location-inventory/trunk)
-
tags/1.1.3/admin/class-multiloca-lite-admin.php (modified) (5 diffs)
-
tags/1.1.3/admin/js/multiloca-lite-admin.js (modified) (1 diff)
-
tags/1.1.3/admin/js/multiloca-lite-product-edit.js (modified) (7 diffs)
-
tags/1.1.3/admin/partials/multiloca-lite-custom-inventory-fields.php (modified) (12 diffs)
-
tags/1.1.3/includes/class-multiloca-lite-activator.php (modified) (1 diff)
-
tags/1.1.3/includes/class-multiloca-lite-cart-location.php (modified) (1 diff)
-
tags/1.1.3/includes/class-multiloca-lite-taxonomy.php (modified) (2 diffs)
-
tags/1.1.3/includes/helper/multiloca-lite-inventory-helper.php (modified) (7 diffs)
-
tags/1.1.3/multiloca-lite-multi-location-inventory.php (modified) (2 diffs)
-
tags/1.1.3/public/class-multiloca-lite-location-filter-widget.php (modified) (2 diffs)
-
tags/1.1.3/public/class-multiloca-lite-public.php (modified) (2 diffs)
-
tags/1.1.3/public/class-multiloca-lite-shop-filter.php (modified) (1 diff)
-
tags/1.1.3/public/controller/shop/views/multiloca-card-view.php (modified) (3 diffs)
-
tags/1.1.3/public/controller/shop/views/multiloca-expanded-view.php (modified) (3 diffs)
-
tags/1.1.3/public/controller/shop/views/multiloca-list-view.php (modified) (3 diffs)
-
tags/1.1.3/public/controller/shop/views/multiloca-simple-text-view.php (modified) (3 diffs)
-
tags/1.1.3/public/controller/shop/views/multiloca-table-view.php (modified) (3 diffs)
-
tags/1.1.3/readme.txt (modified) (1 diff)
-
tags/1.1.3/uninstall.php (modified) (1 diff)
-
trunk/admin/class-multiloca-lite-admin.php (modified) (5 diffs)
-
trunk/admin/js/multiloca-lite-admin.js (modified) (1 diff)
-
trunk/admin/js/multiloca-lite-product-edit.js (modified) (7 diffs)
-
trunk/admin/partials/multiloca-lite-custom-inventory-fields.php (modified) (12 diffs)
-
trunk/includes/class-multiloca-lite-activator.php (modified) (1 diff)
-
trunk/includes/class-multiloca-lite-cart-location.php (modified) (1 diff)
-
trunk/includes/class-multiloca-lite-taxonomy.php (modified) (2 diffs)
-
trunk/includes/helper/multiloca-lite-inventory-helper.php (modified) (7 diffs)
-
trunk/multiloca-lite-multi-location-inventory.php (modified) (2 diffs)
-
trunk/public/class-multiloca-lite-location-filter-widget.php (modified) (2 diffs)
-
trunk/public/class-multiloca-lite-public.php (modified) (2 diffs)
-
trunk/public/class-multiloca-lite-shop-filter.php (modified) (1 diff)
-
trunk/public/controller/shop/views/multiloca-card-view.php (modified) (3 diffs)
-
trunk/public/controller/shop/views/multiloca-expanded-view.php (modified) (3 diffs)
-
trunk/public/controller/shop/views/multiloca-list-view.php (modified) (3 diffs)
-
trunk/public/controller/shop/views/multiloca-simple-text-view.php (modified) (3 diffs)
-
trunk/public/controller/shop/views/multiloca-table-view.php (modified) (3 diffs)
-
trunk/readme.txt (modified) (1 diff)
-
trunk/uninstall.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
multiloca-lite-multi-location-inventory/tags/1.1.3/admin/class-multiloca-lite-admin.php
r3396942 r3401784 38 38 // Load custom inventory fields 39 39 require_once MULTILOCA_LITE_PLUGIN_PATH . 'admin/partials/multiloca-lite-custom-inventory-fields.php'; 40 41 // Add order field to location taxonomy42 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'));46 40 47 41 add_filter('parent_file', array($this, 'wcmlim_lite_submenu_highlight')); … … 61 55 ); 62 56 // 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) { 64 58 65 59 … … 149 143 __('Locations', 'multiloca-lite-multi-location-inventory'), 150 144 'manage_options', 151 'edit-tags.php?taxonomy=locations -lite&post_type=product',145 'edit-tags.php?taxonomy=locations&post_type=product', 152 146 null 153 147 ); … … 614 608 global $current_screen; 615 609 $taxonomy = $current_screen->taxonomy; 616 if ($taxonomy == 'locations -lite') {610 if ($taxonomy == 'locations') { 617 611 $parent_file = 'multiloca-lite-settings'; 618 612 } … … 621 615 622 616 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'; 624 618 625 619 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'; 627 621 } 628 622 return $submenu_file; -
multiloca-lite-multi-location-inventory/tags/1.1.3/admin/js/multiloca-lite-admin.js
r3336945 r3401784 11 11 12 12 function validate_add_location() { 13 if ($(".taxonomy-locations -lite").length > 0) {13 if ($(".taxonomy-locations").length > 0) { 14 14 15 15 var tag_name = $('#tag-name').val(); -
multiloca-lite-multi-location-inventory/tags/1.1.3/admin/js/multiloca-lite-product-edit.js
r3374381 r3401784 27 27 setTimeout(function() { 28 28 // If locations are checked, suggest enabling stock management 29 if ($('#taxonomy-locations -liteinput:checked').length > 0 && !$('#_manage_stock').is(':checked')) {29 if ($('#taxonomy-locations input:checked').length > 0 && !$('#_manage_stock').is(':checked')) { 30 30 log('Locations selected but stock management not enabled'); 31 31 // Add a notice above the stock management field … … 44 44 function getSelectedLocationIds() { 45 45 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() { 47 53 const id = $(this).val(); 48 if (id) { 54 // Skip the 0 value checkbox (usually "All" checkbox) 55 if (id && id !== '0') { 49 56 selectedIds.push(id); 50 57 } … … 216 223 // For new products, select all locations 217 224 if (window.location.href.indexOf('post-new.php') !== -1) { 218 $('#taxonomy-locations -liteinput[type="checkbox"]').prop('checked', true);225 $('#taxonomy-locations input[type="checkbox"]').prop('checked', true); 219 226 log('New product - checking all location boxes'); 220 227 } … … 276 283 277 284 // Listen for changes to checkboxes in the locations taxonomy box 278 $(document).on('change', '#taxonomy-locations -liteinput[type="checkbox"]', function() {285 $(document).on('change', '#taxonomy-locations input[type="checkbox"]', function() { 279 286 log('Location checkbox changed'); 280 287 updateLocationInventoryFields(); … … 282 289 283 290 // Handle "Select All" and "Clear" actions 284 $(document).on('click', '#locations- lite-all', function() {291 $(document).on('click', '#locations-all', function() { 285 292 log('Select All clicked'); 286 293 setTimeout(updateLocationInventoryFields, 100); 287 294 }); 288 295 289 $(document).on('click', '#locations- lite-none', function() {296 $(document).on('click', '#locations-none', function() { 290 297 log('Clear clicked'); 291 298 setTimeout(updateLocationInventoryFields, 100); … … 293 300 294 301 // Handle Most Used tab clicks 295 $(document).on('click', '#locations- lite-pop', function() {302 $(document).on('click', '#locations-pop', function() { 296 303 log('Most Used clicked'); 297 304 setTimeout(updateLocationInventoryFields, 100); … … 304 311 typeof settings.data === 'string' && 305 312 (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)) { 308 315 log('AJAX completed - taxonomy updated'); 309 316 setTimeout(updateLocationInventoryFields, 100); -
multiloca-lite-multi-location-inventory/tags/1.1.3/admin/partials/multiloca-lite-custom-inventory-fields.php
r3377945 r3401784 48 48 } 49 49 50 // Get the parent product ID for location linking 50 51 // Get parent product for location linking 51 52 $variation = wc_get_product($variation_id); 52 53 if (!$variation || !$variation->is_type('variation')) { … … 56 57 57 58 $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 61 60 $heading_text = get_option('wcmlim_txt_in_fdiv', esc_html__('Location Availability', 'multiloca-lite-multi-location-inventory')); 62 61 $instock_text = get_option('wcmlim_txt_in_btn_instock', esc_html__('In Stock', 'multiloca-lite-multi-location-inventory')); … … 78 77 if ($order_by === 'priority') { 79 78 $locations = get_terms(array( 80 'taxonomy' => 'locations -lite',79 'taxonomy' => 'locations', 81 80 'hide_empty' => false, 82 81 'include' => $locations_linked, … … 87 86 } else { 88 87 $locations = get_terms(array( 89 'taxonomy' => 'locations -lite',88 'taxonomy' => 'locations', 90 89 'hide_empty' => false, 91 90 'include' => $locations_linked, … … 582 581 583 582 // 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)); 585 584 586 585 if (empty($locations)) { … … 611 610 // Check for child locations 612 611 $child_locations = get_terms(array( 613 'taxonomy' => 'locations -lite',612 'taxonomy' => 'locations', 614 613 'hide_empty' => false, 615 614 'parent' => $location->term_id, … … 659 658 660 659 // 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']); 662 661 663 662 if (empty($locations_linked)) { … … 672 671 // Get all locations and filter for the linked ones 673 672 $locations = get_terms(array( 674 'taxonomy' => 'locations -lite',673 'taxonomy' => 'locations', 675 674 'hide_empty' => false, 676 675 'include' => $locations_linked // Only include linked locations … … 723 722 724 723 // 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)); 726 725 727 726 if (!empty($locations)) { … … 768 767 769 768 // 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']); 771 770 772 771 if (empty($locations_linked)) { … … 782 781 // Get all locations to loop through 783 782 $all_locations = get_terms(array( 784 'taxonomy' => 'locations -lite',783 'taxonomy' => 'locations', 785 784 'hide_empty' => false 786 785 )); … … 806 805 // Also update the parent product's location link if needed 807 806 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); 809 808 } 810 809 } else { -
multiloca-lite-multi-location-inventory/tags/1.1.3/includes/class-multiloca-lite-activator.php
r3396942 r3401784 61 61 flush_rewrite_rules(); 62 62 } 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 } 63 262 } -
multiloca-lite-multi-location-inventory/tags/1.1.3/includes/class-multiloca-lite-cart-location.php
r3377945 r3401784 417 417 418 418 // 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')); 420 420 421 421 if (empty($linked_locations)) { -
multiloca-lite-multi-location-inventory/tags/1.1.3/includes/class-multiloca-lite-taxonomy.php
r3396942 r3401784 20 20 21 21 // 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); 26 26 } 27 27 … … 70 70 ); 71 71 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]); 95 95 96 96 /**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]); 98 98 /** End Location Group */ 99 99 } -
multiloca-lite-multi-location-inventory/tags/1.1.3/includes/helper/multiloca-lite-inventory-helper.php
r3377945 r3401784 19 19 add_action('init', 'wcmlim_init_inventory_hooks'); 20 20 21 /** 22 * Update inventory data when post meta is updated 23 * This is called when location stock values change 24 */ 25 function 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 21 40 //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(); 41 function 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 } 65 51 } 66 52 … … 77 63 function wcmlim_handle_location_linking($object_id, $terms, $tt_ids, $taxonomy, $append, $old_tt_ids) { 78 64 // Only process for our taxonomy 79 if ($taxonomy !== 'locations -lite') {65 if ($taxonomy !== 'locations') { 80 66 return; 81 67 } … … 127 113 function manage_stock($product, $formatted_location_id, $_meta_value) { 128 114 // 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)); 130 116 $available_stock_meta_key = 'wcmlim_stock_available_at_' . $formatted_location_id; 131 117 … … 134 120 // Get linked locations for the product 135 121 // 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')); 137 123 foreach ($terms as $term) { 138 124 $term_id = $term->term_id; … … 327 313 328 314 // 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')); 330 316 331 317 if (empty($linked_locations)) { … … 529 515 */ 530 516 function 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') { 532 518 // Check if this is a product 533 519 $post_type = get_post_type($object_id); … … 549 535 'tax_query' => array( 550 536 array( 551 'taxonomy' => 'locations -lite',537 'taxonomy' => 'locations', 552 538 'operator' => 'EXISTS', 553 539 ), -
multiloca-lite-multi-location-inventory/tags/1.1.3/multiloca-lite-multi-location-inventory.php
r3396942 r3401784 3 3 * Plugin Name: Multiloca Lite – Multi Locations Inventory Management 4 4 * Description: Manage WooCommerce product inventory by locations and location groups. Display inventory data on the frontend. 5 * Version: 1.1. 25 * Version: 1.1.3 6 6 * Author: Techspawn 7 7 * Author URI: https://techspawn.com/ … … 120 120 private function init_hooks() { 121 121 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 } 122 137 } 123 138 -
multiloca-lite-multi-location-inventory/tags/1.1.3/public/class-multiloca-lite-location-filter-widget.php
r3397110 r3401784 44 44 $title = apply_filters('widget_title', $title, $instance, $this->id_base); 45 45 46 46 47 // Get all locations 47 48 $locations = get_terms(array( 48 'taxonomy' => 'locations -lite',49 'taxonomy' => 'locations', 49 50 'hide_empty' => false, 50 51 'orderby' => 'name', 51 52 'order' => 'ASC' 52 )); 53 54 if (empty($locations) || is_wp_error($locations)) { 53 )); if (empty($locations) || is_wp_error($locations)) { 55 54 return; 56 55 } … … 128 127 'tax_query' => array( 129 128 array( 130 'taxonomy' => 'locations -lite',129 'taxonomy' => 'locations', 131 130 'field' => 'term_id', 132 131 'terms' => $location_id -
multiloca-lite-multi-location-inventory/tags/1.1.3/public/class-multiloca-lite-public.php
r3377945 r3401784 109 109 if ($order_by === 'priority') { 110 110 return get_terms(array( 111 'taxonomy' => 'locations -lite',111 'taxonomy' => 'locations', 112 112 'hide_empty' => false, 113 113 'meta_key' => 'wcmlim_location_priority', … … 117 117 } else { 118 118 return get_terms(array( 119 'taxonomy' => 'locations -lite',119 'taxonomy' => 'locations', 120 120 'hide_empty' => false, 121 121 'orderby' => 'name', -
multiloca-lite-multi-location-inventory/tags/1.1.3/public/class-multiloca-lite-shop-filter.php
r3397110 r3401784 65 65 // Add location filter to tax query 66 66 $tax_query[] = array( 67 'taxonomy' => 'locations -lite',67 'taxonomy' => 'locations', 68 68 'field' => 'term_id', 69 69 'terms' => $selected_locations, -
multiloca-lite-multi-location-inventory/tags/1.1.3/public/controller/shop/views/multiloca-card-view.php
r3396942 r3401784 28 28 $product_id = $product->get_id(); 29 29 // 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']); 31 31 32 32 // Get all locations and filter to only show linked ones if any exist … … 36 36 if ($order_by === 'priority') { 37 37 $all_locations = get_terms(array( 38 'taxonomy' => 'locations -lite',38 'taxonomy' => 'locations', 39 39 'hide_empty' => false, 40 40 'meta_key' => 'wcmlim_location_priority', … … 44 44 } else { 45 45 $all_locations = get_terms(array( 46 'taxonomy' => 'locations -lite',46 'taxonomy' => 'locations', 47 47 'hide_empty' => false, 48 48 'orderby' => 'name', -
multiloca-lite-multi-location-inventory/tags/1.1.3/public/controller/shop/views/multiloca-expanded-view.php
r3396942 r3401784 29 29 30 30 // 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']); 32 32 33 33 // Get all locations and filter to only show linked ones if any exist … … 37 37 if ($order_by === 'priority') { 38 38 $all_locations = get_terms(array( 39 'taxonomy' => 'locations -lite',39 'taxonomy' => 'locations', 40 40 'hide_empty' => false, 41 41 'meta_key' => 'wcmlim_location_priority', … … 45 45 } else { 46 46 $all_locations = get_terms(array( 47 'taxonomy' => 'locations -lite',47 'taxonomy' => 'locations', 48 48 'hide_empty' => false, 49 49 'orderby' => 'name', -
multiloca-lite-multi-location-inventory/tags/1.1.3/public/controller/shop/views/multiloca-list-view.php
r3396942 r3401784 29 29 30 30 // 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']); 32 32 33 33 // Get all locations and filter to only show linked ones if any exist … … 37 37 if ($order_by === 'priority') { 38 38 $all_locations = get_terms(array( 39 'taxonomy' => 'locations -lite',39 'taxonomy' => 'locations', 40 40 'hide_empty' => false, 41 41 'meta_key' => 'wcmlim_location_priority', … … 45 45 } else { 46 46 $all_locations = get_terms(array( 47 'taxonomy' => 'locations -lite',47 'taxonomy' => 'locations', 48 48 'hide_empty' => false, 49 49 'orderby' => 'name', -
multiloca-lite-multi-location-inventory/tags/1.1.3/public/controller/shop/views/multiloca-simple-text-view.php
r3396942 r3401784 29 29 30 30 // 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']); 32 32 33 33 // Get all locations and filter to only show linked ones if any exist … … 37 37 if ($order_by === 'priority') { 38 38 $all_locations = get_terms(array( 39 'taxonomy' => 'locations -lite',39 'taxonomy' => 'locations', 40 40 'hide_empty' => false, 41 41 'meta_key' => 'wcmlim_location_priority', … … 45 45 } else { 46 46 $all_locations = get_terms(array( 47 'taxonomy' => 'locations -lite',47 'taxonomy' => 'locations', 48 48 'hide_empty' => false, 49 49 'orderby' => 'name', -
multiloca-lite-multi-location-inventory/tags/1.1.3/public/controller/shop/views/multiloca-table-view.php
r3396942 r3401784 29 29 30 30 // 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']); 32 32 33 33 // Get all locations and filter to only show linked ones if any exist … … 37 37 if ($order_by === 'priority') { 38 38 $all_locations = get_terms(array( 39 'taxonomy' => 'locations -lite',39 'taxonomy' => 'locations', 40 40 'hide_empty' => false, 41 41 'meta_key' => 'wcmlim_location_priority', … … 45 45 } else { 46 46 $all_locations = get_terms(array( 47 'taxonomy' => 'locations -lite',47 'taxonomy' => 'locations', 48 48 'hide_empty' => false, 49 49 'orderby' => 'name', -
multiloca-lite-multi-location-inventory/tags/1.1.3/readme.txt
r3399138 r3401784 5 5 Tested up to: 6.8 6 6 Requires PHP: 7.0 7 Stable tag: 1.1. 27 Stable tag: 1.1.3 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html -
multiloca-lite-multi-location-inventory/tags/1.1.3/uninstall.php
r3396942 r3401784 30 30 'wcmlim_listing_preset_location', 31 31 'wcmlim_enable_default_location', 32 'wcmlim_sync_stock_between_locations' 32 'wcmlim_sync_stock_between_locations', 33 'wcmlim_taxonomy_migrated' // Migration flag 33 34 ); 34 35 -
multiloca-lite-multi-location-inventory/trunk/admin/class-multiloca-lite-admin.php
r3396942 r3401784 38 38 // Load custom inventory fields 39 39 require_once MULTILOCA_LITE_PLUGIN_PATH . 'admin/partials/multiloca-lite-custom-inventory-fields.php'; 40 41 // Add order field to location taxonomy42 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'));46 40 47 41 add_filter('parent_file', array($this, 'wcmlim_lite_submenu_highlight')); … … 61 55 ); 62 56 // 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) { 64 58 65 59 … … 149 143 __('Locations', 'multiloca-lite-multi-location-inventory'), 150 144 'manage_options', 151 'edit-tags.php?taxonomy=locations -lite&post_type=product',145 'edit-tags.php?taxonomy=locations&post_type=product', 152 146 null 153 147 ); … … 614 608 global $current_screen; 615 609 $taxonomy = $current_screen->taxonomy; 616 if ($taxonomy == 'locations -lite') {610 if ($taxonomy == 'locations') { 617 611 $parent_file = 'multiloca-lite-settings'; 618 612 } … … 621 615 622 616 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'; 624 618 625 619 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'; 627 621 } 628 622 return $submenu_file; -
multiloca-lite-multi-location-inventory/trunk/admin/js/multiloca-lite-admin.js
r3336945 r3401784 11 11 12 12 function validate_add_location() { 13 if ($(".taxonomy-locations -lite").length > 0) {13 if ($(".taxonomy-locations").length > 0) { 14 14 15 15 var tag_name = $('#tag-name').val(); -
multiloca-lite-multi-location-inventory/trunk/admin/js/multiloca-lite-product-edit.js
r3374381 r3401784 27 27 setTimeout(function() { 28 28 // If locations are checked, suggest enabling stock management 29 if ($('#taxonomy-locations -liteinput:checked').length > 0 && !$('#_manage_stock').is(':checked')) {29 if ($('#taxonomy-locations input:checked').length > 0 && !$('#_manage_stock').is(':checked')) { 30 30 log('Locations selected but stock management not enabled'); 31 31 // Add a notice above the stock management field … … 44 44 function getSelectedLocationIds() { 45 45 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() { 47 53 const id = $(this).val(); 48 if (id) { 54 // Skip the 0 value checkbox (usually "All" checkbox) 55 if (id && id !== '0') { 49 56 selectedIds.push(id); 50 57 } … … 216 223 // For new products, select all locations 217 224 if (window.location.href.indexOf('post-new.php') !== -1) { 218 $('#taxonomy-locations -liteinput[type="checkbox"]').prop('checked', true);225 $('#taxonomy-locations input[type="checkbox"]').prop('checked', true); 219 226 log('New product - checking all location boxes'); 220 227 } … … 276 283 277 284 // Listen for changes to checkboxes in the locations taxonomy box 278 $(document).on('change', '#taxonomy-locations -liteinput[type="checkbox"]', function() {285 $(document).on('change', '#taxonomy-locations input[type="checkbox"]', function() { 279 286 log('Location checkbox changed'); 280 287 updateLocationInventoryFields(); … … 282 289 283 290 // Handle "Select All" and "Clear" actions 284 $(document).on('click', '#locations- lite-all', function() {291 $(document).on('click', '#locations-all', function() { 285 292 log('Select All clicked'); 286 293 setTimeout(updateLocationInventoryFields, 100); 287 294 }); 288 295 289 $(document).on('click', '#locations- lite-none', function() {296 $(document).on('click', '#locations-none', function() { 290 297 log('Clear clicked'); 291 298 setTimeout(updateLocationInventoryFields, 100); … … 293 300 294 301 // Handle Most Used tab clicks 295 $(document).on('click', '#locations- lite-pop', function() {302 $(document).on('click', '#locations-pop', function() { 296 303 log('Most Used clicked'); 297 304 setTimeout(updateLocationInventoryFields, 100); … … 304 311 typeof settings.data === 'string' && 305 312 (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)) { 308 315 log('AJAX completed - taxonomy updated'); 309 316 setTimeout(updateLocationInventoryFields, 100); -
multiloca-lite-multi-location-inventory/trunk/admin/partials/multiloca-lite-custom-inventory-fields.php
r3377945 r3401784 48 48 } 49 49 50 // Get the parent product ID for location linking 50 51 // Get parent product for location linking 51 52 $variation = wc_get_product($variation_id); 52 53 if (!$variation || !$variation->is_type('variation')) { … … 56 57 57 58 $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 61 60 $heading_text = get_option('wcmlim_txt_in_fdiv', esc_html__('Location Availability', 'multiloca-lite-multi-location-inventory')); 62 61 $instock_text = get_option('wcmlim_txt_in_btn_instock', esc_html__('In Stock', 'multiloca-lite-multi-location-inventory')); … … 78 77 if ($order_by === 'priority') { 79 78 $locations = get_terms(array( 80 'taxonomy' => 'locations -lite',79 'taxonomy' => 'locations', 81 80 'hide_empty' => false, 82 81 'include' => $locations_linked, … … 87 86 } else { 88 87 $locations = get_terms(array( 89 'taxonomy' => 'locations -lite',88 'taxonomy' => 'locations', 90 89 'hide_empty' => false, 91 90 'include' => $locations_linked, … … 582 581 583 582 // 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)); 585 584 586 585 if (empty($locations)) { … … 611 610 // Check for child locations 612 611 $child_locations = get_terms(array( 613 'taxonomy' => 'locations -lite',612 'taxonomy' => 'locations', 614 613 'hide_empty' => false, 615 614 'parent' => $location->term_id, … … 659 658 660 659 // 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']); 662 661 663 662 if (empty($locations_linked)) { … … 672 671 // Get all locations and filter for the linked ones 673 672 $locations = get_terms(array( 674 'taxonomy' => 'locations -lite',673 'taxonomy' => 'locations', 675 674 'hide_empty' => false, 676 675 'include' => $locations_linked // Only include linked locations … … 723 722 724 723 // 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)); 726 725 727 726 if (!empty($locations)) { … … 768 767 769 768 // 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']); 771 770 772 771 if (empty($locations_linked)) { … … 782 781 // Get all locations to loop through 783 782 $all_locations = get_terms(array( 784 'taxonomy' => 'locations -lite',783 'taxonomy' => 'locations', 785 784 'hide_empty' => false 786 785 )); … … 806 805 // Also update the parent product's location link if needed 807 806 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); 809 808 } 810 809 } else { -
multiloca-lite-multi-location-inventory/trunk/includes/class-multiloca-lite-activator.php
r3396942 r3401784 61 61 flush_rewrite_rules(); 62 62 } 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 } 63 262 } -
multiloca-lite-multi-location-inventory/trunk/includes/class-multiloca-lite-cart-location.php
r3377945 r3401784 417 417 418 418 // 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')); 420 420 421 421 if (empty($linked_locations)) { -
multiloca-lite-multi-location-inventory/trunk/includes/class-multiloca-lite-taxonomy.php
r3396942 r3401784 20 20 21 21 // 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); 26 26 } 27 27 … … 70 70 ); 71 71 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]); 95 95 96 96 /**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]); 98 98 /** End Location Group */ 99 99 } -
multiloca-lite-multi-location-inventory/trunk/includes/helper/multiloca-lite-inventory-helper.php
r3377945 r3401784 19 19 add_action('init', 'wcmlim_init_inventory_hooks'); 20 20 21 /** 22 * Update inventory data when post meta is updated 23 * This is called when location stock values change 24 */ 25 function 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 21 40 //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(); 41 function 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 } 65 51 } 66 52 … … 77 63 function wcmlim_handle_location_linking($object_id, $terms, $tt_ids, $taxonomy, $append, $old_tt_ids) { 78 64 // Only process for our taxonomy 79 if ($taxonomy !== 'locations -lite') {65 if ($taxonomy !== 'locations') { 80 66 return; 81 67 } … … 127 113 function manage_stock($product, $formatted_location_id, $_meta_value) { 128 114 // 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)); 130 116 $available_stock_meta_key = 'wcmlim_stock_available_at_' . $formatted_location_id; 131 117 … … 134 120 // Get linked locations for the product 135 121 // 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')); 137 123 foreach ($terms as $term) { 138 124 $term_id = $term->term_id; … … 327 313 328 314 // 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')); 330 316 331 317 if (empty($linked_locations)) { … … 529 515 */ 530 516 function 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') { 532 518 // Check if this is a product 533 519 $post_type = get_post_type($object_id); … … 549 535 'tax_query' => array( 550 536 array( 551 'taxonomy' => 'locations -lite',537 'taxonomy' => 'locations', 552 538 'operator' => 'EXISTS', 553 539 ), -
multiloca-lite-multi-location-inventory/trunk/multiloca-lite-multi-location-inventory.php
r3396942 r3401784 3 3 * Plugin Name: Multiloca Lite – Multi Locations Inventory Management 4 4 * Description: Manage WooCommerce product inventory by locations and location groups. Display inventory data on the frontend. 5 * Version: 1.1. 25 * Version: 1.1.3 6 6 * Author: Techspawn 7 7 * Author URI: https://techspawn.com/ … … 120 120 private function init_hooks() { 121 121 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 } 122 137 } 123 138 -
multiloca-lite-multi-location-inventory/trunk/public/class-multiloca-lite-location-filter-widget.php
r3397110 r3401784 44 44 $title = apply_filters('widget_title', $title, $instance, $this->id_base); 45 45 46 46 47 // Get all locations 47 48 $locations = get_terms(array( 48 'taxonomy' => 'locations -lite',49 'taxonomy' => 'locations', 49 50 'hide_empty' => false, 50 51 'orderby' => 'name', 51 52 'order' => 'ASC' 52 )); 53 54 if (empty($locations) || is_wp_error($locations)) { 53 )); if (empty($locations) || is_wp_error($locations)) { 55 54 return; 56 55 } … … 128 127 'tax_query' => array( 129 128 array( 130 'taxonomy' => 'locations -lite',129 'taxonomy' => 'locations', 131 130 'field' => 'term_id', 132 131 'terms' => $location_id -
multiloca-lite-multi-location-inventory/trunk/public/class-multiloca-lite-public.php
r3377945 r3401784 109 109 if ($order_by === 'priority') { 110 110 return get_terms(array( 111 'taxonomy' => 'locations -lite',111 'taxonomy' => 'locations', 112 112 'hide_empty' => false, 113 113 'meta_key' => 'wcmlim_location_priority', … … 117 117 } else { 118 118 return get_terms(array( 119 'taxonomy' => 'locations -lite',119 'taxonomy' => 'locations', 120 120 'hide_empty' => false, 121 121 'orderby' => 'name', -
multiloca-lite-multi-location-inventory/trunk/public/class-multiloca-lite-shop-filter.php
r3397110 r3401784 65 65 // Add location filter to tax query 66 66 $tax_query[] = array( 67 'taxonomy' => 'locations -lite',67 'taxonomy' => 'locations', 68 68 'field' => 'term_id', 69 69 'terms' => $selected_locations, -
multiloca-lite-multi-location-inventory/trunk/public/controller/shop/views/multiloca-card-view.php
r3396942 r3401784 28 28 $product_id = $product->get_id(); 29 29 // 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']); 31 31 32 32 // Get all locations and filter to only show linked ones if any exist … … 36 36 if ($order_by === 'priority') { 37 37 $all_locations = get_terms(array( 38 'taxonomy' => 'locations -lite',38 'taxonomy' => 'locations', 39 39 'hide_empty' => false, 40 40 'meta_key' => 'wcmlim_location_priority', … … 44 44 } else { 45 45 $all_locations = get_terms(array( 46 'taxonomy' => 'locations -lite',46 'taxonomy' => 'locations', 47 47 'hide_empty' => false, 48 48 'orderby' => 'name', -
multiloca-lite-multi-location-inventory/trunk/public/controller/shop/views/multiloca-expanded-view.php
r3396942 r3401784 29 29 30 30 // 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']); 32 32 33 33 // Get all locations and filter to only show linked ones if any exist … … 37 37 if ($order_by === 'priority') { 38 38 $all_locations = get_terms(array( 39 'taxonomy' => 'locations -lite',39 'taxonomy' => 'locations', 40 40 'hide_empty' => false, 41 41 'meta_key' => 'wcmlim_location_priority', … … 45 45 } else { 46 46 $all_locations = get_terms(array( 47 'taxonomy' => 'locations -lite',47 'taxonomy' => 'locations', 48 48 'hide_empty' => false, 49 49 'orderby' => 'name', -
multiloca-lite-multi-location-inventory/trunk/public/controller/shop/views/multiloca-list-view.php
r3396942 r3401784 29 29 30 30 // 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']); 32 32 33 33 // Get all locations and filter to only show linked ones if any exist … … 37 37 if ($order_by === 'priority') { 38 38 $all_locations = get_terms(array( 39 'taxonomy' => 'locations -lite',39 'taxonomy' => 'locations', 40 40 'hide_empty' => false, 41 41 'meta_key' => 'wcmlim_location_priority', … … 45 45 } else { 46 46 $all_locations = get_terms(array( 47 'taxonomy' => 'locations -lite',47 'taxonomy' => 'locations', 48 48 'hide_empty' => false, 49 49 'orderby' => 'name', -
multiloca-lite-multi-location-inventory/trunk/public/controller/shop/views/multiloca-simple-text-view.php
r3396942 r3401784 29 29 30 30 // 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']); 32 32 33 33 // Get all locations and filter to only show linked ones if any exist … … 37 37 if ($order_by === 'priority') { 38 38 $all_locations = get_terms(array( 39 'taxonomy' => 'locations -lite',39 'taxonomy' => 'locations', 40 40 'hide_empty' => false, 41 41 'meta_key' => 'wcmlim_location_priority', … … 45 45 } else { 46 46 $all_locations = get_terms(array( 47 'taxonomy' => 'locations -lite',47 'taxonomy' => 'locations', 48 48 'hide_empty' => false, 49 49 'orderby' => 'name', -
multiloca-lite-multi-location-inventory/trunk/public/controller/shop/views/multiloca-table-view.php
r3396942 r3401784 29 29 30 30 // 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']); 32 32 33 33 // Get all locations and filter to only show linked ones if any exist … … 37 37 if ($order_by === 'priority') { 38 38 $all_locations = get_terms(array( 39 'taxonomy' => 'locations -lite',39 'taxonomy' => 'locations', 40 40 'hide_empty' => false, 41 41 'meta_key' => 'wcmlim_location_priority', … … 45 45 } else { 46 46 $all_locations = get_terms(array( 47 'taxonomy' => 'locations -lite',47 'taxonomy' => 'locations', 48 48 'hide_empty' => false, 49 49 'orderby' => 'name', -
multiloca-lite-multi-location-inventory/trunk/readme.txt
r3399138 r3401784 5 5 Tested up to: 6.8 6 6 Requires PHP: 7.0 7 Stable tag: 1.1. 27 Stable tag: 1.1.3 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html -
multiloca-lite-multi-location-inventory/trunk/uninstall.php
r3396942 r3401784 30 30 'wcmlim_listing_preset_location', 31 31 'wcmlim_enable_default_location', 32 'wcmlim_sync_stock_between_locations' 32 'wcmlim_sync_stock_between_locations', 33 'wcmlim_taxonomy_migrated' // Migration flag 33 34 ); 34 35
Note: See TracChangeset
for help on using the changeset viewer.