<?php // 1. Neue Registrierungen automatisch als Profi-Kunde add_action('user_register','set_profi_role');function set_profi_role($user_id){$user=new WP_User($user_id);$user->set_role('profi-kunde');// Name der Rolle muss exakt stimmen}// 2. Wholesale-Preis nur für Profi-Kunden anzeigen add_filter('woocommerce_get_price_html','wholesale_price_for_profi',100,2);function wholesale_price_for_profi($price,$product){if(is_user_logged_in()){$user=wp_get_current_user();if(in_array('profi-kunde',(array) $user->roles)){$wholesale_price=get_post_meta($product->get_id(),'_wholesale_price',true);// ggf. Feldname anpassen if($wholesale_price){$price=wc_price($wholesale_price)}}}return $price}