• Resolved reshampanth

    (@reshampanth)


    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

    (@themehigh)

    >> 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

    (@reshampanth)

    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

    (@themehigh)

    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

    (@themehigh)

    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

    (@reshampanth)

    Hi ThemeHigh,

    You’ve solved my problem! Thank you for the swift help! This is exactly what I was looking for!

    Plugin Author ThemeHigh

    (@themehigh)

    Great!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Add Field Value Programmatically before Placing Order’ is closed to new replies.