0

I have added the data by this code. It's inserted successfully. But how can I get the meta by function? I have tried with get_post_meta() but it's not working.

add_action( 'woocommerce_checkout_create_order_line_item', 'add_custom_order_line_item_meta',10,4 );
function add_custom_order_line_item_meta($item, $cart_item_key, $values, $order){

    if(array_key_exists('course_name_one', $values) {

        $item->add_meta_data('Test ID',$values['course_name_one']);
      
    }
}
Kane
  • 605
  • 2
  • 8
  • 22
  • Does this answer your question? https://stackoverflow.com/questions/48565643/get-the-metadata-of-an-order-item-in-woocommerce-3/48567687 – CBroe Aug 27 '20 at 08:05
  • Does this answer your question? [Get the metadata of an order item in woocommerce 3](https://stackoverflow.com/questions/48565643/get-the-metadata-of-an-order-item-in-woocommerce-3) – loic.lopez Aug 27 '20 at 10:03
  • Here's a good reference - https://stackoverflow.com/questions/39401393/how-to-get-woocommerce-order-details – beatnik Aug 27 '20 at 11:51

0 Answers0