Joey Ricketts

Creating a Custom ‘Add To Cart’ Redirect with One Page Checkout

Looking to create a custom ‘Add to Cart’ redirect for your customers on WooCommerce with a one step checkout process?

This article will explain the best way to create a custom ‘Add to Cart’ redirect to use alongside the One Page Checkout extension. Many customers are lost once they reach the Cart page, so a more streamlined process is a great idea.

Step 1: Download and install the One Page Checkout extension.

one page checkout

Step 2: Create a custom One Page Checkout page by inserting the following shortcode: [woocommerce_one_page_checkout]

**The cart and checkout pages are still needed in order for One Page Checkout to work correctly. This page should not be replacing either of those.**

woocommerce_one_page_checkout shortcode

Step 3: Copy and paste the following code snippet into your theme’s functions.php file:

function custom_a2c( $url ) {
	$url = get_permalink( 121 ); // URL to redirect to (121 is the page ID here)
	return $url;
add_filter( 'woocommerce_add_to_cart_redirect', 'custom_a2c' );

Step 4: Replace ‘121’ with your new One Page Checkout page post ID.

page ID example

Step 5: Navigate to your product page and click ‘Add to Cart’:

screen recording add to cart

That’s how easy this process is!

I hope this has helped those that were looking for an easy way to add a custom redirect to a simple one page style checkout process!

Previous Post

Leave a Reply

© 2019 Joey Ricketts

Theme by Anders Norén