Plugin Directory

Changeset 3442520


Ignore:
Timestamp:
01/19/2026 12:18:50 PM (2 months ago)
Author:
enituretechnology
Message:

4.5.28 - 2026-01-14

  • Fix: Improved brand and category filtering by supporting both native WooCommerce and custom brand taxonomies.

Ticket 39679965555

Location:
small-package-quotes-ups-edition
Files:
6 edited
1 copied

Legend:

Unmodified
Added
Removed
  • small-package-quotes-ups-edition/tags/4.5.28/readme.txt

    r3430547 r3442520  
    33Tags: eniture,UPS,parcel rates, parcel quotes, shipping estimates
    44Requires at least: 6.6
    5 Tested up to: 6.8
    6 Stable tag: 4.5.27
     5Tested up to: 6.9
     6Stable tag: 4.5.28
    77License:           GPL-2.0-or-later
    88License URI:       https://www.gnu.org/licenses/gpl-2.0.html
     
    142142
    143143== Changelog ==
     144
     145= 4.5.28 - 2026-01-19 =
     146* Fix: Improved brand and category filtering by supporting both native WooCommerce and custom brand taxonomies.
    144147
    145148= 4.5.27 - 2026-01-01 =
  • small-package-quotes-ups-edition/tags/4.5.28/small-package-quotes-ups-edition.php

    r3430547 r3442520  
    44 * Plugin URI:     https://eniture.com/products/
    55 * Description:    Dynamically retrieves your negotiated shipping rates from UPS and displays the results in the WooCommerce shopping cart.
    6  * Version:        4.5.27
     6 * Version:        4.5.28
    77 * Author:         Eniture Technology
    88 * Author URI:     http://eniture.com/
     
    1010 * License:           GPL-2.0-or-later
    1111 * License URI:       https://www.gnu.org/licenses/gpl-2.0.html
    12  * Requires at least: 6.6
    13  * Requires PHP:      7.4
     12 * Requires Plugins: woocommerce
    1413 */
    1514if (!defined('ABSPATH')) {
  • small-package-quotes-ups-edition/tags/4.5.28/ups-small-group-package.php

    r3430547 r3442520  
    3939        $this->is_country_filter_applied = false;
    4040        $this->is_restrict_service_rule_applied = false;
     41    }
     42
     43    /**
     44     * Get product terms safely with WP_Error handling and taxonomy fallback
     45     */
     46    private function get_product_terms_safely($product_id, $parent_id, $taxonomies)
     47    {
     48        foreach ($taxonomies as $taxonomy) {
     49            if (!taxonomy_exists($taxonomy)) {
     50                continue;
     51            }
     52
     53            $terms = get_the_terms($product_id, $taxonomy);
     54            if (is_wp_error($terms) || empty($terms)) {
     55                $terms = get_the_terms($parent_id, $taxonomy);
     56            }
     57
     58            if (!is_wp_error($terms) && !empty($terms) && is_array($terms)) {
     59                return array_map(function($term) { return $term->term_id; }, $terms);
     60            }
     61        }
     62
     63        return false;
    4164    }
    4265
     
    308331
    309332                    // Product tags
    310                     $product_tags = get_the_terms($product_id, 'product_tag');
    311                     $product_tags = empty($product_tags) ? get_the_terms($parent_id, 'product_tag') : $product_tags;
    312                     if (!empty($product_tags)) {
    313                         $product_tag_names = array_map(function($tag) { return $tag->term_id; }, $product_tags);
    314 
     333                    $product_tag_names = $this->get_product_terms_safely($product_id, $parent_id, ['product_tag']);
     334                    if ($product_tag_names !== false && !empty($product_tag_names)) {
    315335                        if (isset($ups_small_package[$locationId]['product_tags'])) {
    316336                            $ups_small_package[$locationId]['product_tags'] = array_merge($ups_small_package[$locationId]['product_tags'], $product_tag_names);
     
    337357
    338358                    // Product categories
    339                     $product_categories = get_the_terms($product_id, 'product_cat');
    340                     $product_categories = empty($product_categories) ? get_the_terms($parent_id, 'product_cat') : $product_categories;
    341                     if (!empty($product_categories)) {
    342                         $product_category_names = array_map(function($category) { return $category->term_id; }, $product_categories);
    343 
     359                    $product_category_names = $this->get_product_terms_safely($product_id, $parent_id, ['product_cat']);
     360                    if ($product_category_names !== false && !empty($product_category_names)) {
    344361                        if (isset($ups_small_package[$locationId]['product_categories'])) {
    345362                            $ups_small_package[$locationId]['product_categories'] = array_merge($ups_small_package[$locationId]['product_categories'], $product_category_names);
     
    348365                        }
    349366                    } else {
    350                         $ups_small_package[$locationId]['product_categories'] = [];
    351                     }
    352 
    353                     // Product brands
    354                     $product_brands = get_the_terms($product_id, 'product_brand');
    355                     $product_brands = empty($product_brands) ? get_the_terms($parent_id, 'product_brand') : $product_brands;
    356                     if (!empty($product_brands)) {
    357                         $product_brand_names = array_map(function($brand) { return $brand->term_id; }, $product_brands);
    358 
     367                        $ups_small_package[$locationId]['product_categories'] = isset($ups_small_package[$locationId]['product_categories']) && !empty($ups_small_package[$locationId]['product_categories']) ? $ups_small_package[$locationId]['product_categories'] : [];
     368                    }
     369
     370                    $product_brand_names = $this->get_product_terms_safely($product_id, $parent_id, ['product_brand', 'brand']);
     371                    if ($product_brand_names !== false && !empty($product_brand_names)) {
    359372                        if (isset($ups_small_package[$locationId]['product_brands'])) {
    360373                            $ups_small_package[$locationId]['product_brands'] = array_merge($ups_small_package[$locationId]['product_brands'], $product_brand_names);
     
    363376                        }
    364377                    } else {
    365                         $ups_small_package[$locationId]['product_brands'] = [];
     378                        $ups_small_package[$locationId]['product_brands'] = isset($ups_small_package[$locationId]['product_brands']) && !empty($ups_small_package[$locationId]['product_brands']) ? $ups_small_package[$locationId]['product_brands'] : [];
    366379                    }
    367380                }
  • small-package-quotes-ups-edition/trunk/readme.txt

    r3430547 r3442520  
    33Tags: eniture,UPS,parcel rates, parcel quotes, shipping estimates
    44Requires at least: 6.6
    5 Tested up to: 6.8
    6 Stable tag: 4.5.27
     5Tested up to: 6.9
     6Stable tag: 4.5.28
    77License:           GPL-2.0-or-later
    88License URI:       https://www.gnu.org/licenses/gpl-2.0.html
     
    142142
    143143== Changelog ==
     144
     145= 4.5.28 - 2026-01-19 =
     146* Fix: Improved brand and category filtering by supporting both native WooCommerce and custom brand taxonomies.
    144147
    145148= 4.5.27 - 2026-01-01 =
  • small-package-quotes-ups-edition/trunk/small-package-quotes-ups-edition.php

    r3430547 r3442520  
    44 * Plugin URI:     https://eniture.com/products/
    55 * Description:    Dynamically retrieves your negotiated shipping rates from UPS and displays the results in the WooCommerce shopping cart.
    6  * Version:        4.5.27
     6 * Version:        4.5.28
    77 * Author:         Eniture Technology
    88 * Author URI:     http://eniture.com/
     
    1010 * License:           GPL-2.0-or-later
    1111 * License URI:       https://www.gnu.org/licenses/gpl-2.0.html
    12  * Requires at least: 6.6
    13  * Requires PHP:      7.4
     12 * Requires Plugins: woocommerce
    1413 */
    1514if (!defined('ABSPATH')) {
  • small-package-quotes-ups-edition/trunk/ups-small-group-package.php

    r3430547 r3442520  
    3939        $this->is_country_filter_applied = false;
    4040        $this->is_restrict_service_rule_applied = false;
     41    }
     42
     43    /**
     44     * Get product terms safely with WP_Error handling and taxonomy fallback
     45     */
     46    private function get_product_terms_safely($product_id, $parent_id, $taxonomies)
     47    {
     48        foreach ($taxonomies as $taxonomy) {
     49            if (!taxonomy_exists($taxonomy)) {
     50                continue;
     51            }
     52
     53            $terms = get_the_terms($product_id, $taxonomy);
     54            if (is_wp_error($terms) || empty($terms)) {
     55                $terms = get_the_terms($parent_id, $taxonomy);
     56            }
     57
     58            if (!is_wp_error($terms) && !empty($terms) && is_array($terms)) {
     59                return array_map(function($term) { return $term->term_id; }, $terms);
     60            }
     61        }
     62
     63        return false;
    4164    }
    4265
     
    308331
    309332                    // Product tags
    310                     $product_tags = get_the_terms($product_id, 'product_tag');
    311                     $product_tags = empty($product_tags) ? get_the_terms($parent_id, 'product_tag') : $product_tags;
    312                     if (!empty($product_tags)) {
    313                         $product_tag_names = array_map(function($tag) { return $tag->term_id; }, $product_tags);
    314 
     333                    $product_tag_names = $this->get_product_terms_safely($product_id, $parent_id, ['product_tag']);
     334                    if ($product_tag_names !== false && !empty($product_tag_names)) {
    315335                        if (isset($ups_small_package[$locationId]['product_tags'])) {
    316336                            $ups_small_package[$locationId]['product_tags'] = array_merge($ups_small_package[$locationId]['product_tags'], $product_tag_names);
     
    337357
    338358                    // Product categories
    339                     $product_categories = get_the_terms($product_id, 'product_cat');
    340                     $product_categories = empty($product_categories) ? get_the_terms($parent_id, 'product_cat') : $product_categories;
    341                     if (!empty($product_categories)) {
    342                         $product_category_names = array_map(function($category) { return $category->term_id; }, $product_categories);
    343 
     359                    $product_category_names = $this->get_product_terms_safely($product_id, $parent_id, ['product_cat']);
     360                    if ($product_category_names !== false && !empty($product_category_names)) {
    344361                        if (isset($ups_small_package[$locationId]['product_categories'])) {
    345362                            $ups_small_package[$locationId]['product_categories'] = array_merge($ups_small_package[$locationId]['product_categories'], $product_category_names);
     
    348365                        }
    349366                    } else {
    350                         $ups_small_package[$locationId]['product_categories'] = [];
    351                     }
    352 
    353                     // Product brands
    354                     $product_brands = get_the_terms($product_id, 'product_brand');
    355                     $product_brands = empty($product_brands) ? get_the_terms($parent_id, 'product_brand') : $product_brands;
    356                     if (!empty($product_brands)) {
    357                         $product_brand_names = array_map(function($brand) { return $brand->term_id; }, $product_brands);
    358 
     367                        $ups_small_package[$locationId]['product_categories'] = isset($ups_small_package[$locationId]['product_categories']) && !empty($ups_small_package[$locationId]['product_categories']) ? $ups_small_package[$locationId]['product_categories'] : [];
     368                    }
     369
     370                    $product_brand_names = $this->get_product_terms_safely($product_id, $parent_id, ['product_brand', 'brand']);
     371                    if ($product_brand_names !== false && !empty($product_brand_names)) {
    359372                        if (isset($ups_small_package[$locationId]['product_brands'])) {
    360373                            $ups_small_package[$locationId]['product_brands'] = array_merge($ups_small_package[$locationId]['product_brands'], $product_brand_names);
     
    363376                        }
    364377                    } else {
    365                         $ups_small_package[$locationId]['product_brands'] = [];
     378                        $ups_small_package[$locationId]['product_brands'] = isset($ups_small_package[$locationId]['product_brands']) && !empty($ups_small_package[$locationId]['product_brands']) ? $ups_small_package[$locationId]['product_brands'] : [];
    366379                    }
    367380                }
Note: See TracChangeset for help on using the changeset viewer.