In WooCommerce, I would like to show on product variations the related variation attribute(s), in Order details and email notifications, like in my cart page:
As you can see in this screenshot, I want to display the related variation attribute for product variation in Order details and email notifications:
How can I achieve it?
Since Nobody answer my question i tried to do it by myself again. The Solution is put this code in your child-theme function.php file
add_action('woocommerce_order_item_meta_end', 'ts_order_item_meta_start', 10, 4);
function ts_order_item_meta_start($item_id, $item, $order, $plain_text) {
// Retrieve the '_option1' meta value for the current item
// I'm getting the key _option1 because it was in the DB the key in the table. So maybe check out in your db what's the key called and replace everywhere where i have "_option1"
$option1_value = $item->get_meta('_option1');
if (!empty($option1_value)) {
// If '_option1' meta key exists, display it
echo '<p>' . esc_html($option1_value) . '</p>';
}
}