I have a form where people can register for a seminar, which entails filling out your personal info and then selecting which seminar (s) you want to attend, and how many tickets you want to buy. The user would fill it the form and when clicking submit, he is directed to a woocommerce shop page so he can add the desired seminar to his cart and pay for them.

I am trying to get rid of the middle step where the user adds the items to his cart, and would love to use the info from the form to add the respective items to the cart automatically.

I have found the following code which uses the on_sent_ok hook but I believe that is now obsolete and I'm not sure how to use it to add more than one product and quantities from their respective fields in the contact form: on_sent_ok: "location.replace('http://www.YOURSITE.com/checkout/?add-to-cart=ID');"

Any ideas of code or plugins would be greatly appreciated!

  • Unfortunately, it still falls into the 3rd party plugin territory umbrella which if we make an exception for we would need to make an exception for all 3rd party plugins. It's been in our rules for years and lengthy discussions have been had on WordPress Meta regarding this topic. To clarify, all 3rd party plugins are off-topic no matter who built or supports them. – Howdy_McGee Aug 2 '18 at 16:02

Add to cart is still working - try

  • Thanks, but I am not sure how to use this code to get multiple products and their quantities from a field... – harvey Jun 17 '18 at 3:20

Not the answer you're looking for? Browse other questions tagged or ask your own question.