• Resolved daniellahampton

    (@daniellahampton)


    I’ve added some extra fields to my Woocommerce .cart form
    I’m trying to store the values that the user put into them in as metadata on the item in the cart.
    I’ve found so many posts about how to do it, and how that these solutions are no longer the preferred way of going about it.
    I literally cannot make it work.

    add_action(‘woocommerce_checkout_create_order_line_item’, ‘add_order_item_custom_meta’, 10, 4 );
    function add_order_item_custom_meta( $item, $cart_item_key, $cart_item, $order ) {
    $item->update_meta_data( ‘_custom_info’, $_SESSION[‘custom_info’] );
    }
    This looks like the most recent way (that doesn’t work :D).
    Where the html ID of the field is #custom_info.

    Any ideas how to get this to work, or where to look to do it properly?

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Add form data to order item’s metadata’ is closed to new replies.