on-internet
← Community

Update woocommerce order item custom meta field

Stack Overflow ·

I am trying to add a simple input field to the order backend and use it to update my order item information. It's a simple meta called "Number of People". It seems like everything is working ok, except that saving the order does NOT update the meta field the way it's built right now. What could I be doing wrong? /* Add custom field to cart item data */ add_filter('woocommerce_add_cart_item_data', function ($cart_item_data, $product_id, $variation_id) { if (isset($_POST['number_of_people'])) { $cart_item_data['number_of_people'] = (int) sanitize_text_field($_POST['number_of_people']); } return

Comments

Sign in or sign up to comment and upvote.

No comments yet.