Quantcast
Channel: (Anti) Social Development » Redirect
Viewing all articles
Browse latest Browse all 2

Use the Contact Form 7 plugin to Add a Product to the WooCommerce Cart and Redirect to Checkout

$
0
0
Use the Contact Form 7 plugin to Add a Product to the WooCommerce Cart and Redirect to Checkout
Use the Contact Form 7 plugin to Add a Product to the WooCommerce Cart and Redirect to Checkout

Previously I wrote about how to redirect the Contact Form 7 form to a thank you page.

If you are using WooCommerce and are gathering data via a form prior to checkout, you can also redirect the Contact Form 7 form directly to the checkout for the product. And the product will be added to the cart first before the redirection to the checkout.


Remember that Contact Form 7 can be redirected by placing the following in the Additional Settings field.

on_sent_ok: "location.replace('http://www.YOURSITE.com/name of page');"

If you want to add a product to the cart after gathering information via the form and then redirect to the WooCommerce checkout, add the following to the Contact Form 7 Additional Settings field.

on_sent_ok: "location.replace('http://www.YOURSITE.com/checkout/?add-to-cart=ID');"

The product ID is available in the browser address bar when you are on the Edit Product screen. For example, in this URL http://yoursite.com/wp-admin/post.php?post=9020&action=edit the ID is 9020.

Do you use Contact Form 7? Is redirecting the form useful to you? Do you use WooCommerce?

If you would like to hire me to assist with your WooCommerce or WordPress project, please contact me and we can discuss the details.

photo credit: sanjoselibrary

The post Use the Contact Form 7 plugin to Add a Product to the WooCommerce Cart and Redirect to Checkout appeared first on (Anti) Social Development.


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images