In this tutorial, I will explain how to redirect user directly to checkout page after adding product to cart in WooCommerce. This is very simple & easy code snippets to extends the features of your WooCommerce based online store.
Copy the below code snippets and add at the end of your wp-content/themes/your-theme-folder/functions.php file.
1 2 3 4 5 6 7 | add_filter ('add_to_cart_redirect', 'redirect_to_checkout'); function redirect_to_checkout() { return WC()->cart->get_checkout_url(); } |
Now visit your front-end website and open the product details page and click on Add to cart button.
When you click on Add to cart button, then it will redirect to the check out page. It will skip the cart page.
Do you like & share this article with your friends, and don’t forget to follow us on Facebook and Twitter to learn cool WordPress tutorials.
If you like FreeWebMentor and you would like to contribute, you can write an article and mail your article to [email protected] Your article will appear on the FreeWebMentor main page and help other developers.
Article Tags: woocommerce add to cart, woocommerce checkout page, wordpress tutorial, wordpress tutorial for beginner, wordpress tutorial for beginners, wordpress tutorials, wordpress tutorials for beginners, wordpress tutorils