Add ordernumber to line item
-
Hi,
I am wondering wether it is possible to add the order number as meta_data to the line item. We are working with merging and splitting plugins and to be able to recall where the item was originally belonged to we would like to add this information.
I tried the code below, but it is adding as order number “0” to the line items.// Add order Id as custom order item meta data add_action( 'woocommerce_checkout_create_order_line_item', 'add_meta_to_line_item', 10, 4 ); function add_meta_to_line_item( $item, $cart_item_key, $values, $order ) { $item->add_meta_data( 'order_nummer', $order->get_id() ); }
Maybe I am adding the function too early?
I hope you can help me out ??
Best regards,
Olga
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Add ordernumber to line item’ is closed to new replies.