php - Pass cart meta to order meta -


i looking way pass post cart meta order meta in woocommerce.

i using code

function wifive_add_random_product($product, $post_id, $control = 0){      global $woocommerce;     $variation = 0;     $produkt = (int)$product;     $numer_postu = (int)$post_id;       $custommeta = array(     'featured' => $numer_postu     );   $woocommerce->cart->add_to_cart($produkt, $quantity = 1, $variation_id = '', $variation = '', $custommeta); 

everything great, , after adding cart, information stored in serialized array

array (     [cart] => array (     [0f1beffb02d3fa7b85e7765cc7d8dc8b] => array         (             [featured] => 9794     [...] 

but gone after check out :/ way make function pass "featured" field order meta?

thank you!


Comments