wc_add_order_item_meta no working

/*
* Add meta to order item
* @param int $item_id
* @param array $values
* @return void
*/
function cart_add_meta_data_booking( $item_id, $values ) {
if ( ! empty( $values[‘adults_qty’] ) ):
wc_add_order_item_meta( $item_id, ‘Adults’, $values[‘adults_qty’]);
endif;
}
add_action( ‘woocommerce_new_order_item’, ‘cart_add_meta_data_booking’, 10, 2 );

I have updated my code because the previous function (woocommerce_add_order_item_meta) is deprecated, but I do not know why it does not work (wc_add_order_item_meta)

Read more here:: wc_add_order_item_meta no working

Leave a Reply

Your email address will not be published. Required fields are marked *