Title: Add Field Value Programmatically before Placing Order
Last modified: June 1, 2021

---

# Add Field Value Programmatically before Placing Order

 *  Resolved [reshampanth](https://wordpress.org/support/users/reshampanth/)
 * (@reshampanth)
 * [5 years ago](https://wordpress.org/support/topic/add-field-value-programmatically-before-placing-order/)
 * Hi,
    I’m creating a product for which I need an additional text field. The value
   of this field will be defined by the customer’s actions prior to clicking on 
   the Add TO Cart link. The Customer will provide two values prior and based on
   those values, I have to add the appropriate product to cart directly using Woocommerce
   hooks WC()->cart->add_to_cart( 1326 ) My first question is, how do I set the 
   value for the additional field manually before adding the product to cart? My
   second question is, how do I display this in the Cart and Checkout page? Will
   the field automatically show up along with the cart information? Will it work
   with Oxygen Builder?

Viewing 6 replies - 1 through 6 (of 6 total)

 *  Plugin Author [ThemeHigh](https://wordpress.org/support/users/themehigh/)
 * (@themehigh)
 * [5 years ago](https://wordpress.org/support/topic/add-field-value-programmatically-before-placing-order/#post-14514820)
 * **>> The Customer will provide two values prior and based on those values, I 
   have to add the appropriate product to cart directly using Woocommerce hooks 
   WC()->cart->add_to_cart( 1326 )**
 * We are a little bit unclear about your exact requirement. Could you please clarify
   us with more details?
 * **>> how do I set the value for the additional field manually before adding the
   product to cart?**
 * The field created using our plugin will be available on the product page. If 
   you want to pre-define the values for the field then you can use the field type“
   Select”. Also, you can show the field to a particular product by providing a 
   conditional rule for the field based on the product.
 * **>> how do I display this in the Cart and Checkout page? Will the field automatically
   show up along with the cart information? **
 * Yes, the value selected or provided on the extra product field will display in
   both cart and checkout.
 * **>> Will it work with Oxygen Builder?**
 * It is compatible with the functionality of the oxygen builder plugin. However,
   there are few display style issues.
 * Thank you!
 *  Thread Starter [reshampanth](https://wordpress.org/support/users/reshampanth/)
 * (@reshampanth)
 * [5 years ago](https://wordpress.org/support/topic/add-field-value-programmatically-before-placing-order/#post-14519578)
 * Hi ThemeHigh,
 * Sorry for the ambiguity. What I mean is, I’ll be using URL params based on the
   visitor’s activity on the website, and using those URL params I’ll be dynamically
   placing the order using Woocommerce PHP functions.
 * So the visitor will never see the Product page. I need to input one of those 
   URL params in the text custom field so that the Addon Field is visible in the
   Cart, Checkout, and Order page.
 * I hope that gives some clarity to my question!
 *  Plugin Author [ThemeHigh](https://wordpress.org/support/users/themehigh/)
 * (@themehigh)
 * [5 years ago](https://wordpress.org/support/topic/add-field-value-programmatically-before-placing-order/#post-14527680)
 * You can pass the value as shown below:
 * ?add-to-cart=8&field_name1=field_name1_value&field_name2=field_name2_value&thwepof_product_fields
   =field_name1,field_name2
 * You need to pass each field with its value. Then add additional argument thwepof_product_fields
   whose value equal to the comma-separated field names.
 * Thank you!
 *  Plugin Author [ThemeHigh](https://wordpress.org/support/users/themehigh/)
 * (@themehigh)
 * [5 years ago](https://wordpress.org/support/topic/add-field-value-programmatically-before-placing-order/#post-14531282)
 * Please ensure that you have checked the option “**Allow posting extra options
   as url parameters**” in the plugin’s **Advanced Settings** tab.
 * Thank you!
 *  Thread Starter [reshampanth](https://wordpress.org/support/users/reshampanth/)
 * (@reshampanth)
 * [5 years ago](https://wordpress.org/support/topic/add-field-value-programmatically-before-placing-order/#post-14534041)
 * Hi ThemeHigh,
 * You’ve solved my problem! Thank you for the swift help! This is exactly what 
   I was looking for!
 *  Plugin Author [ThemeHigh](https://wordpress.org/support/users/themehigh/)
 * (@themehigh)
 * [4 years, 12 months ago](https://wordpress.org/support/topic/add-field-value-programmatically-before-placing-order/#post-14544686)
 * Great!

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Add Field Value Programmatically before Placing Order’ is closed to new
replies.

 * ![](https://ps.w.org/woo-extra-product-options/assets/icon-256x256.gif?rev=3241643)
 * [Extra Product Options For WooCommerce | Custom Product Addons and Fields](https://wordpress.org/plugins/woo-extra-product-options/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woo-extra-product-options/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woo-extra-product-options/)
 * [Active Topics](https://wordpress.org/support/plugin/woo-extra-product-options/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woo-extra-product-options/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woo-extra-product-options/reviews/)

 * 6 replies
 * 2 participants
 * Last reply from: [ThemeHigh](https://wordpress.org/support/users/themehigh/)
 * Last activity: [4 years, 12 months ago](https://wordpress.org/support/topic/add-field-value-programmatically-before-placing-order/#post-14544686)
 * Status: resolved