Assign class to Drop Down Selections in WooCommerce Products Custom Fields

You can do in the following way!

  1. Create an array of CSS class names and message values

    $colors_stings = array(
        'Message one' => 'message_color_green',
        'Message two'   => 'message_color_red',
        'Message three' => 'message_color_blue'
    );
    
  2. Check if message string exist in array then assign CSS color class to variable.

    $css_class = isset($colors_stings[$product_status]) ? $colors_stings[$product_status] : 'message_default_color';
    

Complete Example:-

$colors_stings = array(
    'Message one' => 'message_color_green',
    'Message two'   => 'message_color_red',
    'Message three' => 'message_color_blue'
);

$product_status = get_post_meta( $post->ID, 'productstatus_select', true );
$css_class = isset($colors_stings[$product_status]) ? $colors_stings[$product_status] : 'message_default_color';

echo '<p class="productstatus '. $css_class . '">' . $product_status .'</p>';

deneme bonusu veren sitelerbahis casinomakrobetceltabetpinbahispolobetpolobet girişpinbahis girişmakrobet girişpulibet girişmobilbahis girişkolaybet giriş