Hi! Thank you! My final code for others who need:
`<?php
//functions.php
use Atum\Inc\Helpers;
use Atum\Suppliers\Suppliers;
use Atum\Suppliers\Supplier;
add_action('woocommerce_checkout_create_order_line_item', 'custom_checkout_create_order_line_item', 20, 4);
function custom_checkout_create_order_line_item($item, $cart_item_key, $values, $order)
{
require_once('wp-content/plugins/atum-stock-manager-for-woocommerce/vendor/autoload.php');
$custom_field_value = get_post_meta($item->get_product_id(), '_sku', true);
if (! empty($custom_field_value)) {
$item->update_meta_data('sko', $custom_field_value);
}
if (class_exists("Atum\Inc\Helpers")) {
$atum_product = \Atum\Inc\Helpers::get_atum_product($item->get_product_id());
$supplier_id = $atum_product->get_supplier_id();
if ($supplier_id) {
$supplier = new \Atum\Suppliers\Supplier($supplier_id);
if ($supplier) {
$item->update_meta_data('supplier', $supplier->name);
}
}
}
}
// Hide from email
add_filter( 'woocommerce_order_item_get_formatted_meta_data', 'unset_specific_order_item_meta_data', 10, 2);
function unset_specific_order_item_meta_data($formatted_meta, $item){
// Only on emails notifications
if( is_admin() || is_wc_endpoint_url() )
return $formatted_meta;
foreach( $formatted_meta as $key => $meta ){
if( in_array( $meta->key, array('supplier', 'sku') ) )
unset($formatted_meta[$key]);
}
return $formatted_meta;
}
`