Bu şekilde
$html = '<div class="urun">';
$html .= '<select id="hesaplar" onchange="urunYakala(this, \''.$currenysym.'\')">'; /*** Buraya currenysym kodunu ekledim Ekledim ***/
$argumen = array(
'meta_key' => '_price',
'orderby' => 'meta_value_num',
'order' => 'ASC',
'limit'=> -1,
'category' => array( 'denemekategorisi' ),
'status' => 'publish',
);
$producter = wc_get_products( $argumen );
foreach ($producter as $producted) {
$urunbaslik = $producted->get_name();
$urunfiyat = number_format($producted->get_price(), 2, '.', '');
$urunid = $producted->get_id();
$urunadi = explode(" ", $urunbaslik);
$urunayrac = str_replace( array("@", "_", "."), '', $urunadi[1]);
$html .= '<option value="'. $urunid .'">'. $urunayrac . ' ' . $urunfiyat .'</option>';
}
$html .= '</select>';
$html .= '</div>';
$html .= '<script>';
$html .= 'function urunYakala(select, currency) {';
$html .= ' var urun_id = select.options[select.selectedIndex].value;';
$html .= ' var urun_ayraci = select.options[select.selectedIndex].text.split(" ")[0];'; /*** Ayracı neye göre parse edeceğini kendin düzenlemelisin ***/
$html .= ' var urun_adi = select.options[select.selectedIndex].text.split(" ")[0];';
$html .= ' var urun_fiyati = select.options[select.selectedIndex].text.split(" ")[1];';
$html .= ' $("div.urun" + urun_id + " .fiyatgoruntusu").html("Fiyat: " + urun_fiyati + " " + currency);';
$html .= ' $("div.urun" + urun_id + " .gorsel").attr("src","https://www.spspsp.com/wp-content/uploads/" + urun_ayraci + ".jpg");';
$html .= ' $("div.urun" + urun_id + " .gorsel").attr("alt",urun_adi);';
$html .= '}';
$html .= '</script>';
return $html;Bundan sonraki adım için JS bilginiz yeterli ise çözebilirsiniz.
Veya özelden anydesk iletin ufak bir ücret karşılığı yardımcı olabilirim
Hocam elinize sağlık bende sizin attıklarınızdan yola çıkarak kafamda bir şeyler kurdum ve çalıştırmayı başardım. Umarım bu tarz ihtiyaçları olan insanlara faydalarımız dokunur