Misafir adlı üyeden alıntı: mesajı görüntüle
Bu şekilde

$html = '<div class="urun">';
$html .= '<select id="hesaplar" onchange="urunYakala(this)">'; /*** Buraya Onchange 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>function urunYakala(select) { alert(select.options[select.selectedIndex].text); }</script>'; /*** Ekstra olarak bu satırı ekledim ***/
return $html;


select.options[select.selectedIndex].text => Seçilen objenin görünen yazısı
select.options[select.selectedIndex].value => Seçilen objenin value değeri - sizin için ürünün ID'si
Hocam benim şimdi aşağıda ki gibi bir kodum var

if(value == '.$urunid.') { { $("div.urun'.$productid.' .fiyatgoruntusu").html("Fiyat: '.$urunfiyat.' '.$currenysym.'");
$("div.urun'.$productid.' .gorsel").attr("src","https://www.spspsp.com/wp-content/uploads/'.$urunayrac.'.jpg");
$("div.urun'.$productid.' .gorsel").attr("alt","'.$urunadi.'");    }
bunları foreach kısmından bağımsız olarak bu kısımda nasıl kullanabilirim çünkü araya çok fazla ek .html giriyor birleştirmek zor