Задать вопрос
@AlisherBekenov

Как исправить данную ошибку в коде?

function jeroen_sormani_change_city_to_dropdown( $fields ) {

	$city_args = wp_parse_args( array(
		'type' => 'select',
		'options' => array(
			'AbuAlDhalouf' => 'Abu Al Dhalouf',
			'AlDaayen' => 'Al Daayen',
			'ALKharaitiyat'   => 'AL Kharaitiyat',
			'AlRuwais' => 'Al Ruwais',
			'AlSakama'    => 'Al Sakama',
			'Leabuib'  => 'Leabuib',
			'RasLaffan' => 'Ras Laffan',
			'RawdatAlHamama' => 'Rawdat Al Hamama',
			'Sumaysismah'   => 'Sumaysismah',
			'UmAlAhmed' => 'Um Al Ahmed',
			'UmEbairriya'    => 'Um Ebairriya',
			'UmSalalMuhammad'  => 'Um Salal Muhammad',
			'UmsalalAli' => 'Um salal Ali',
			'AbuHamour' => 'Abu Hamour',
			'AinKhaled'   => 'Ain Khaled',
			'AlKhulaifatAljadeeda' => 'Al Khulaifat Al jadeeda ',
			'AlMaamoura'    => 'Al Maamoura',
			'BarwaCity'  => 'Barwa City',
			'Mesaimeer' => 'Mesaimeer',
			'UmmAlSeneem' => 'Umm Al Seneem',
			'AlKharrara'   => 'Al Kharrara',
			'AlMashaf' => 'Al Mashaf',
			'BarwaVillage'    => 'Barwa Village',
			'Mesaieed'  => 'Mesaieed',	
			'RasAbuFontas'  => 'Ras Abu Fontas',	
			'AlDakira'  => 'Al Dakira',	
			'AlKhor'  => 'Al Khor',	
			'AlKhorindustrialArea'  => 'Al Khor industrial Area',
			'AlKhorCommunity'  => 'Al Khor Community',	
			'AlGhuwayriyah'  => 'Al Ghuwayriyah',
			'MadinathAlSamal'  => 'Madinath Al Samal',
			'UmmBirkah'  => 'Umm Birkah',
			'UmmQarn'  => 'Umm Qarn',
			'AlBidda'  => 'Al Bidda',
			'AlJasra'  => 'Al Jasra',
			'ALMarkhiya'  => 'AL Markhiya',
			'AlMirqabAlJadeed'  => 'Al Mirqab Al Jadeed',
			'AlNasr'  => 'Al Nasr',
			'AlRumailiawest'  => 'Al Rumailia west',
			'AlSaad'  => 'Al Saad',
			'AlSoudan'  => 'Al Soudan',
			'AlSouq'  => 'Al Souq',
			'AlWaab'  => 'Al Waab',
			'ALZaeemArea'  => 'AL Zaeem Area ',
			'ALMirqab'  => 'AL Mirqab',
			'Baaya'  => 'Baaya',
			'BarahatAljufairi'  => 'Barahat Al jufairi',
			'Dohaport'  => 'Doha port ',
			'FereejAlAmeer'  => 'Fereej Al Ameer',
			'FereejBinMahmoud'  => 'Fereej Bin Mahmoud ',
			'HamadMedicalCity'  => 'Hamad Medical City ',
			'HazmAlMarkhiya'  => 'Hazm Al Markhiya',
			'Mehairja'  => 'Mehairja ',
			'Mushaireb'  => 'Mushaireb',
			'NewAlHitmi'  => 'New Al Hitmi',
			'AbuNakhla'  => 'Abu Nakhla ',
			'AlAziziya'  => 'Al Aziziya',
			'AlLuqta'  => 'Al Luqta',
			'AlMurra'  => 'Al Murra',
			'AlMorraEast'  => 'Al Morra East',
			'AlMorraWeast'  => 'Al Morra Weast',
			'ALRayyanAlJadded'  => 'AL Rayyan Al Jadded',
			'AlRayyanAlQadeem'  => 'Al Rayyan Al Qadeem',
			'Al Ruffa'  => 'Al Ruffa',
			'Al Sailiya'  => 'Al Sailiya',
			'Al Wajba'  => 'Al Wajba',
			'Al Jumayliyah'  => 'Al Jumayliyah',
			'Ash Shahaniyah'  => 'Ash Shahaniyah',
			'At Turiyah'  => 'At Turiyah',
			'Bani Hajer'  => 'Bani Hajer',
			'Dukhan'  => 'Dukhan',
			'EducationCity'  => 'Education City',
			'Fuwayrit'  => 'Fuwayrit',
			'GarrafatAlRayyan'  => 'Garrafat Al Rayyan',
			'IndustrialArea'  => 'Industrial Area',
			'Izghawa'  => 'Izghawa',
			'Manaseer'  => 'Manaseer',
			'Muaither'  => 'Muaither',
			'MuaitherNorth'  => 'Muaither North',
			'MuaitherSouth'  => 'Muaither South',
			'Muraikh'  => 'Muraikh',
			'NewAlGhanim'  => 'New Al Ghanim',
			'QatarFoundation'  => 'Qatar Foundation',
			'MallofQatar'  => 'Mall of Qatar',
			'RawdatRashid'  => 'Rawdat Rashid',
			'UmmBab'  => 'Umm Bab',
			'Busamra'  => 'Bu samra', 
			'BuSidra'  => 'Bu Sidra', 
			'AlDuhailSouth'  => 'Al Duhail South', 
			'AlKhisah'  => 'Al Khisah', 
			'AlDafna'  => 'Al Dafna', 
			'AlDuhail'  => 'Al Duhail', 
			'ALDuhailNorth'  => 'AL Duhail North', 
			'AlEbb'  => 'Al Ebb', 
			'AlJabailat'  => 'Al Jabailat', 
			'ALKhuwair'  => 'AL Khuwair', 
			'AlTarfa'  => 'Al Tarfa', 
			'AlMessila'  => 'Al Messila', 
			'DahlAlHammam'  => 'Dahl Al Hammam', 
			'FerrejBinOmran'  => 'Ferrej Bin Omran', 
			'FerrejKhulib'  => 'Ferrej Khulib', 
			'Jelaiah'  => 'Jelaiah', 
			'JeryanNejaima'  => 'Jeryan Nejaima', 
			'Katara'  => 'Katara', 
			'LandMarkArea'  => 'Land Mark Area', 
			'Luaib'  => 'Luaib', 
			'Lusail'  => 'Lusail', 
			'MadinathKhalifaSouth'  => 'Madinath Khalifa South', 
			'MadinathKhalifaNorth'  => 'Madinath Khalifa North', 
			'Onaizia'  => 'Onaizia', 
			'QatarUniversity'  => 'Qatar University', 
			'Qutaifia'  => 'Qutaifia', 
			'ThePearlQatar'  => 'The Pearl Qatar',
			'UmmLekhba'  => 'Umm Lekhba', 
			'WadiAlSail'  => 'Wadi Al Sail', 
			'WestBay'  => 'West Bay', 
			'WestBayLagoon'  => 'West Bay Lagoon', 
			'AirportArea'  => 'Airport Area', 
			'AlAsiri'  => 'Al Asiri', 
			'AlDohaAljadeeda'  => 'Al Doha Al jadeeda', 
			'AlGhanim'  => 'Al Ghanim', 
			'AlHilal'  => 'Al Hilal',
			'AlHitmi'  => 'Al Hitmi',
			'AlMansoura'  => 'Al Mansoura',
			'AlMuntazah'  => 'Al Muntazah',
			'AlSalata'  => 'Al Salata',
			'AlThumama'  => 'Al Thumama',
			'FereejAbdulAziz'  => 'Fereej Abdul Aziz',
			'FereejAlAli'  => 'Fereej Al Ali',
			'FereejBinDirham'  => 'Fereej Bin Dirham',
			'HamadInternationalAirport'  => 'Hamad International Airport',
			'Najma'  => 'Najma',
			'NewSalata'  => 'New Salata',
			'Nuaija'  => 'Nuaija',
			'OldAirport'  => 'Old Airport',
			'RasAbuAbboud'  => 'Ras Abu Abboud',
			'RawdatAlKhail'  => 'Rawdat Al Khail',
			'UmmGhuwailina'  => 'Umm Ghuwailina',
		),
		'input_class' => array(
			'wc-enhanced-select',
		)
	), $fields['shipping']['shipping_city'] );

	$fields['shipping']['shipping_city'] = $city_args;
	$fields['billing']['billing_city'] = $city_args; // Also change for billing field

	wc_enqueue_js( "
	jQuery( ':input.wc-enhanced-select' ).filter( ':not(.enhanced)' ).each( function() {
		var select2_args = { minimumResultsForSearch: 5 };
		jQuery( this ).select2( select2_args ).addClass( 'enhanced' );
	});" );

	return $fields;

}
add_filter( 'woocommerce_checkout_fields', 'jeroen_sormani_change_city_to_dropdown' );


При добавлении 86 городов ошибка не появляется, при добавлении больше 86 городов появляется ошибка:

Your PHP code changes were rolled back due to an error on line 134 of file wp-content/themes/kadence/functions.php. Please fix and try saving again.

syntax error, unexpected ''BuSidra'' (T_CONSTANT_ENCAPSED_STRING), expecting ')'
  • Вопрос задан
  • 19 просмотров
Подписаться 1 Простой Комментировать
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы