WooCommerce - excelling eCommerce
WooCommerce add input field to every item in cart (2 posts)

  1. narinders
    Posted 1 year ago #

    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?


  2. narinders
    Posted 1 year ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WooCommerce - excelling eCommerce
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic