Support » Plugin: WooCommerce » WooCommerce add input field to every item in cart

  • I need to add a single text input field to every item in the cart (make that a required field) and submit that user input to product’s meta info.

    So far, I have copied the template file to my theme and added an input field inside a cell. What I am having trouble with is, which hook do I manipulate and how do I submit the data? Please help.

    Wrote following code, successfully displayed the input field but not sure if the user input is getting saved and how to get it displayed on order page (in admin dashboard).

    ` <?php $inputurl = sprintf( ‘<div class=”input-url”><input type=”text” name=”cart-url” value=”” title=”” class=”input-text cart-url text” /></div>’, $cart_item_key, esc_attr( $values[‘inputurl’] ) );
    echo apply_filters( ‘woocommerce_cart_item_url’, $inputurl, $cart_item_key );
    ?> `

    Now I think I need help finding out if (and where) the data is being saved and how can I display it on order page. Also, I’d like to include it in confirmation email being sent to customer. Is that possible?

    https://wordpress.org/plugins/woocommerce/

Viewing 1 replies (of 1 total)
  • Still searching for solution. Realized I’ve been using wrong hook. Will post in this thread once I complete the code. Will appreciate if someone suggests a solution.

Viewing 1 replies (of 1 total)
  • The topic ‘WooCommerce add input field to every item in cart’ is closed to new replies.