WooCommerce is really popular e-commerce plugin in WordPress space. It has more that 5+ million active installations. If you are using WooCommerce in your website, then this article might helpful.
Once the customers done with checkout, we redirect them to thank you page in WooCommerce. If you want to get some more info from user, you can use this thank you page for collecting more info from customers.
We can do changes to woocommerce/checkout/thankyou.php. We can do it by template overriding. This template can be overridden by copying it to yourtheme/woocommerce/checkout/thankyou.php
Or you can use the hooks systems of WordPress. The thankyou.php file contains some hooks we can use it.
do_action( 'woocommerce_thankyou', $order--->get_id() )
In this section, we’ll use contact form 7 to create a form in our WooCommerce order details page.
add_action('woocommerce_thankyou', 'collect_details', 10, 1); function collect_details( $order_id ) { if ( ! $order_id ) return; echo "Please give your feedback"; echo do_shortcode('[contact-form-7 id="270" title="Contact form 1"]'); }
We are using a contact form to collect user feedback.This is a very simple example of how to do some action after WooCommerce checkout. We can even display a pop form or redirect user.
Leave a Reply