Book Image

WooCommerce Cookbook

By : Patrick Rauland
Book Image

WooCommerce Cookbook

By: Patrick Rauland

Overview of this book

Table of Contents (17 chapters)
WooCommerce Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Skipping the cart and going straight to checkout


This recipe will be useful for you if you have the type of store where most people only buy one product and thus the cart isn't very useful. In such cases, you might want to remove the cart altogether and have the customer skip the cart page and go straight to the checkout.

Note

We have covered a similar recipe, Making the Add to Cart button go straight to the checkout page, in Chapter 3, Changing the Product Organization, which uses a plugin instead of code.

Getting ready

In the WordPress admin, you need to make sure the Redirect to the cart page after successsful addition option under WooCommerce | Settings | Products | Display is checked.

How to do it…

We'll be writing a bit of code to change the page that a customer lands on after adding a product to the cart. You'll want to put this in either your theme's functions.php file or in a custom plugin. Let's take a look at the following steps:

  1. Open either your theme's functions.php file or a custom...