mercredi 15 septembre 2021

Hide meta IF it's 'something' and 'somethingelse' in Foreach loop else display all

Code below is great to display ALL the meta of an item in the order - How do I hide certain meta from displaying? eg. display all except if meta key is 'something' and 'somethingelse'

    <?php
foreach ( $order->get_items() as $item_id => $item ) {
    $item_meta_data = $order_item_product->get_meta_data();
    echo $product_name = $order_item_product->get_name();
    echo '<br>';
foreach( $item_meta_data as $meta_data ) {
        $meta_data_as_array = $meta_data->get_data();
        echo $meta_data_as_array['key'].': '.$meta_data_as_array['value'].'<br>';   
        
       
}

}
?>

Aucun commentaire:

Enregistrer un commentaire