Input field woocommerce cart - php

I am trying to have order notes on the cart page instead of on the checkout page.
I actually only need to have an input field on the cart page and have the inputted text passed on to the order in admin. Does anyone have a good solution for this?

You can override your templates:
http://docs.woothemes.com/document/template-structure/

Related

WooCommerce 5.6.0 Checkout Coupon Form Issue using functions.php

My original coupon box was set by default to the top.
I'm using How do I move the apply coupon input below the order on the checkout page in Woocommerce? answer code and moved the box below products in the "my order" section.
Each time I submit a coupon, it removes some of the entered data as the page is being submitted.
Is there a method to remove this submit page feature & have it behave like the default option where it updates without refreshing the page?
Thanks in advance!

Woocommerce -- Adding Products with Javascript/PHP

I have a custom form that users make various selections before being presented with products they can buy. I need to add some logic that if an input has been selected when the user adds a product to the cart, it will also add an additional product to the cart.
The input is 3 radio check boxes. Somehow I need to hook into the add to cart click and check the page to see if one of the radios has been selected and then add the appropriate product but I'm not sure where to start.
I know I'll need to have an action that runs something like:
WC()->cart->add_to_cart( 'product_id', 'quantity');
But I'm not sure how to hook into the initial add to cart click and how to check for the radios on the page.
Thank you for your help.
Not a lot of information to go off of here, but here is a few useful WooCommerce hooks to give you a starting point/ order of operations. When overriding any native action in WordPress or its plugins. You should use the hooks if available.
Add the radio inputs to the single product before the add to cart is added (hook):
add_action("woocommerce_before_add_to_cart_button", "your_input_render_function_here");
Add the new input data from the radio buttons to the cart item (filter):
add_filter("woocommerce_add_cart_item_data", "your_filter_function_to_capture_data_here");
Capture the data and render in cart (filter):
add_filter("woocommerce_get_item_data", "your_cart_render_function");
Finally, save the newly aquired data to the order (hook):
add_action("woocommerce_checkout_create_order_line_item", "your_function_to_add_to_order")
This is one of many directions you can take, depending on your requirements. I recommend giving it a shot, and if you still have issues return with an example of your code.

Change order in Woocommerce checkout

I need to change the layout of the Woocommerce checkout page. I need to move the payment option box along with the terms&conditions checkobox ABOVE the order-review table. The "Place Order" button should stay at the bottom though.
I know I need to override the template in my childtheme, but I just can't get this to work as the payment box is combined together with the order-review table. Or is this somehow possible via a function?
Thank you!

Add Custom Input Field on Woocommerce Cart Page

I've been developing a WooCommerce site and I have a task where I have stuck. I need to add an extra custom input field into the cart items table.
Like for example, if a person orders '2000 youtube views' package, then right below the item name, I want the user to input his Youtube video URL.
I know I can add custom input fields on Product Page and can simply make them display on the Cart Page. But I want to take user input data onto the Cart Page. Each cart item will have a custom input field. So far, I have researched a lot but didn't have any success for my solution. All I found that to print the custom input field data onto the cart page added on the Product Page.
Any help would be appreciated
I've had this problem also. I've solved it with this. Adding the fields on the cart page like you did but with jQuery receive those values and dynamicly transfer them with a GET request, ( adding them to the submit button ) and $_GET fill them in the checkout page in a hidden input type.

How to add an input filed to single product page in woocommerce to store extra user comments in the order?

I am using latest wp and wc and I am trying to add a form field in the frontend single product page where the user will be able to add comments which when the order is done the data will be available under woocommerce -> orders. Have anybody done that or it's not even possible because woocommerce is pretty limited for stuff like this?

Categories