Plugin Directory

Changeset 3362093


Ignore:
Timestamp:
09/15/2025 10:13:54 PM (5 months ago)
Author:
webikon
Message:

Fixed Czech Republic country code mapping

Location:
wc-dpd
Files:
90 added
3 edited

Legend:

Unmodified
Added
Removed
  • wc-dpd/trunk/includes/DpdExport.php

    r3339385 r3362093  
    271271        // Add country ISO code
    272272        $country = isset($data[self::CUSTOMER_COUNTRY_KEY]) && !empty($data[self::CUSTOMER_COUNTRY_KEY]) ? $data[self::CUSTOMER_COUNTRY_KEY] : '';
    273         $country_data = (new ISO3166())->alpha2($country);
    274         $this->{self::CUSTOMER_COUNTRY_KEY} = !empty($country_data['numeric']) ? (int) $country_data['numeric'] : '';
     273
     274        // Fix for Czech Republic - WooCommerce uses 'cs' but ISO3166 needs 'CZ'
     275        if (strtolower($country) === 'cs') {
     276            $country = 'CZ';
     277        }
     278
     279        try {
     280            // Convert to uppercase for ISO3166 compatibility
     281            $country_data = (new ISO3166())->alpha2(strtoupper($country));
     282            $this->{self::CUSTOMER_COUNTRY_KEY} = !empty($country_data['numeric']) ? (int) $country_data['numeric'] : '';
     283        } catch (Exception $e) {
     284            // Log error and keep original value if country code is invalid
     285            error_log('DPD Export: ' . $e->getMessage());
     286            $this->{self::CUSTOMER_COUNTRY_KEY} = $country;
     287        }
    275288    }
    276289
  • wc-dpd/trunk/readme.txt

    r3350089 r3362093  
    66Tested up to: 6.8.2
    77Requires PHP: 7.4
    8 Stable tag: 8.2.0
     8Stable tag: 8.2.1
    99License: GPLv2 or later
    1010License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    6262
    6363== Changelog ==
     64
     65= 8.2.1 =
     66* Fixed Czech Republic country code mapping (WooCommerce 'cs' to ISO3166 'CZ')
    6467
    6568= 8.2.0 =
  • wc-dpd/trunk/wc-dpd.php

    r3350089 r3362093  
    44 * Plugin Name: DPD SK for WooCommerce
    55 * Description: DPD SK plugin for WooCommerce which exports orders to the DPD through their API
    6  * Version: 8.2.0
     6 * Version: 8.2.1
    77 * Author: Webikon
    88 * Author URI: https://www.webikon.sk
     
    1515 * Requires PHP: 7.4
    1616 * WC requires at least: 7.0
    17  * WC tested up to: 10.1.1
     17 * WC tested up to: 10.1.2
    1818 */
    1919
Note: See TracChangeset for help on using the changeset viewer.