Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Woocommerce: Skip the product page and cart page to go straight to checkout

If your are selling an ebook or tickets via woocommerce and you want your buyer to go straight to Checkout instead of product page and Cart when click on product link.
if you want your buyer click on link or button to buy product from any page or post add a product to the cart without even visiting the product page and skip the cart page.

Well this can be done by adding a link on the page or post and being redirected to the checkout directly with the product being added to the cart automatically.

Simply add a link on your page or post

http://your-site.com/?add-to-cart=37

For Example: Buy Now

Replace http://your-site.com with your homepage URL and 37 by your product ID

Then add the following code to your functions.php file within your theme folder

/* woocommerce skip cart and redirect to checkout. */
function woocommerce_skip_cart() {
	$checkout_url = WC()->cart->get_checkout_url();
	return $checkout_url;
}
add_filter ('woocommerce_add_to_cart_redirect', 'woocommerce_skip_cart');

The post Woocommerce: Skip the product page and cart page to go straight to checkout appeared first on Wasim Sama.



This post first appeared on Wasim Sama, please read the originial post: here

Share the post

Woocommerce: Skip the product page and cart page to go straight to checkout

×

Subscribe to Wasim Sama

Get updates delivered right to your inbox!

Thank you for your subscription

×