woocomerce sitemde oluşan siparişleri shopiere post ediyorum. fakat city kısmı null dönüyor napsam çözemedim. yapmak istediğim şey siparişin il bilgisini , eşleşen ilin plakası ile değiştirip il ismi yerine plaka göndermek. örnek olarak istanbul yerine TR34.

 $products[] = array(
                    'name' => trim($expProductName[0]),
                    'product_id' => $item['product_id'],
                    'product_type' => $producttype,
                    'quantity' => $item['quantity'],
                    'variation' => $variationNames,
                    'price' => $product->get_regular_price(),
                    'discount_price' => $product->get_sale_price() ? $product->get_sale_price() : null,
                    'subtotal_price' => $item['subtotal'],
                    'total_price' => $item['total'],
                    'subtotal_tax' => $item['subtotal_tax'],
                    'total_tax' => $item['total_tax'],
                );
            }

            $productNames = str_replace('"','',$productNames);
            $productNames = str_replace('"','',$productNames);
            $current_language = get_bloginfo("language");
            $current_lan = 0;
            if ($current_language == "tr-TR") {
                $current_lan = 0;
            }
            $modul_version = ('2.0.0');
            srand(time());
            $random_number = rand(100000, 999999);
            

            $province_codes = array(
    'Adana' => 'TR01',
    'Adıyaman' => 'TR02',
    'Afyon' => 'TR03',
    'Ağrı' => 'TR04',
    'Amasya' => 'TR05',
    'Ankara' => 'TR06',
    'Antalya' => 'TR07',
    'Artvin' => 'TR08',
    'Aydın' => 'TR09',
    'Balıkesir' => 'TR10',
    'Bilecik' => 'TR11',
    'Bingöl' => 'TR12',
    'Bitlis' => 'TR13',
    'Bolu' => 'TR14',
    'Burdur' => 'TR15',
    'Bursa' => 'TR16',
    'Çanakkale' => 'TR17',
    'Çankırı' => 'TR18',
    'Çorum' => 'TR19',
    'Denizli' => 'TR20',
    'Diyarbakır' => 'TR21',
    'Edirne' => 'TR22',
    'Elazığ' => 'TR23',
    'Erzincan' => 'TR24',
    'Erzurum' => 'TR25',
    'Eskişehir' => 'TR26',
    'Gaziantep' => 'TR27',
    'Giresun' => 'TR28',
    'Gümüşhane' => 'TR29',
    'Hakkari' => 'TR30',
    'Hatay' => 'TR31',
    'Isparta' => 'TR32',
    'İçel' => 'TR33',
    'İstanbul' => 'TR34',
    'İzmir' => 'TR35',
    'Kars' => 'TR36',
    'Kastamonu' => 'TR37',
    'Kayseri' => 'TR38',
    'Kırklareli' => 'TR39',
    'Kırşehir' => 'TR40',
    'Kocaeli' => 'TR41',
    'Konya' => 'TR42',
    'Kütahya' => 'TR43',
    'Malatya' => 'TR44',
    'Manisa' => 'TR45',
    'Kahramanmaraş' => 'TR46',
    'Mardin' => 'TR47',
    'Muğla' => 'TR48',
    'Muş' => 'TR49',
    'Nevşehir' => 'TR50',
    'Niğde' => 'TR51',
    'Ordu' => 'TR52',
    'Rize' => 'TR53',
    'Sakarya' => 'TR54',
    'Samsun' => 'TR55',
    'Siirt' => 'TR56',
    'Sinop' => 'TR57',
    'Sivas' => 'TR58',
    'Tekirdağ' => 'TR59',
    'Tokat' => 'TR60',
    'Trabzon' => 'TR61',
    'Tunceli' => 'TR62',
    'Şanlıurfa' => 'TR63',
    'Uşak' => 'TR64',
    'Van' => 'TR65',
    'Yozgat' => 'TR66',
    'Zonguldak' => 'TR67',
    'Aksaray' => 'TR68',
    'Bayburt' => 'TR69',
    'Karaman' => 'TR70',
    'Kırıkkale' => 'TR71',
    'Batman' => 'TR72',
    'Şırnak' => 'TR73',
    'Bartın' => 'TR74',
    'Ardahan' => 'TR75',
    'Iğdır' => 'TR76',
    'Yalova' => 'TR77',
    'Karabük' => 'TR78',
    'Kilis' => 'TR79',
    'Osmaniye' => 'TR80',
    'Düzce' => 'TR81',
);

// Sipariş detaylarından il bilgisini al
$billing_city = $order->billing_city;
$shipping_city = $order->shipping_city;

// İl bilgisini plaka kodlarıyla değiştir
$billing_province = isset($province_codes[$billing_city]) ? $province_codes[$billing_city] : '';
$shipping_province = isset($province_codes[$shipping_city]) ? $province_codes[$shipping_city] : '';


$country_code = 'Türkiye';

if ($this->use_adress == 0) {
    $args = array(
        'API_key' => $this->api_key,
        'website_index' => $this->website_index,
        'use_adress' => $this->use_adress,
        'platform_order_id' => $order_id,
        'product_info' => json_encode($products, JSON_UNESCAPED_UNICODE),
        'general_info' => json_encode($generalInfo, JSON_UNESCAPED_UNICODE),
        'product_name' => $productNames,
        'product_type' => $producttype,
        'buyer_name' => $order->billing_first_name,
        'buyer_surname' => $order->billing_last_name,
        'buyer_email' => $order->billing_email,
        'buyer_account_age' => $buyer_account_age,
        'buyer_id_nr' => $user_id,
        'buyer_phone' => $order->billing_phone,
        'billing_address' => $order->billing_address_1 . ' ' . $order->billing_address_2 . ' ' . $billing_province_code,
        'billing_city' => $order->billing_city,
        'billing_country' => $country_code,
        'billing_postcode' => $order->billing_postcode,
        'shipping_address' => $order->shipping_address_1 . ' ' . $order->shipping_address_2 . ' ' . $shipping_province_code,
        'shipping_city' => $order->shipping_city,
        'shipping_country' => $country_code,
        'shipping_postcode' => $order->shipping_postcode,
        'total_order_value' => $order->order_total,
        'currency' => $currency,
        'platform' => 0,
        'is_in_frame' => 0,
        'current_language' => $current_lan,
        'modul_version' => $modul_version,
        'random_nr' => $random_number
    );
} else if ($this->use_adress == 1) {
    $args = array(
        'API_key' => $this->api_key,
        'website_index' => $this->website_index,
        'use_adress' => $this->use_adress,
        'platform_order_id' => $order_id,
        'product_info' => json_encode($products, JSON_UNESCAPED_UNICODE),
        'general_info' => json_encode($generalInfo, JSON_UNESCAPED_UNICODE),
        'product_name' => $productNames,
        'product_type' => $producttype,
        'buyer_name' => $order->shipping_first_name,
        'buyer_surname' => $order->shipping_last_name,
        'buyer_email' => $order->billing_email,
        'buyer_account_age' => $buyer_account_age,
        'buyer_id_nr' => $user_id,
        'buyer_phone' => $order->billing_phone,
        'billing_address' => $order->shipping_address_1 . ' ' . $order->shipping_address_2 . ' ' . $shipping_province_code,
        'billing_city' => $order->shipping_city,
        'billing_country' => $country_code,
        'billing_postcode' => $order->shipping_postcode,
        'shipping_address' => $order->billing_address_1 . ' ' . $order->billing_address_2 . ' ' . $billing_province_code,
        'shipping_city' => $order->billing_city,
        'shipping_country' => $country_code,
        'shipping_postcode' => $order->billing_postcode,
        'total_order_value' => $order->order_total,
        'currency' => $currency,
        'platform' => 0,
        'is_in_frame' => 0,
        'current_language' => $current_lan,
        'modul_version' => $modul_version,
        'random_nr' => $random_number
    );
}