Forked from constructyourself/woocommerce-add-to-cart-direct-checkout.php
Created
July 25, 2016 23:54
-
-
Save Giannisduke/d2189f5a67efd13c7bc1b750562aba32 to your computer and use it in GitHub Desktop.
WooCommerce - add product and show checkout
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
/* | |
Wordpress + WooCommerce | |
Add product directly to cart and take user to Checkout page | |
Instructions: | |
- add all php code within comment block below to active Wordpress theme file: functions.php | |
- use URL structure: http://your-site.com/?add-to-cart=37 WHERE 37 is the ID of your WooCommerce Product | |
*/ | |
/* | |
add everything within this comment to your Wordpress theme functions.php | |
*/ | |
add_filter ('woocommerce_add_to_cart_redirect', 'woo_redirect_to_checkout'); | |
function woo_redirect_to_checkout() { | |
$checkout_url = WC()->cart->get_checkout_url(); | |
return $checkout_url; | |
} | |
/* | |
END - direct checkout of product in cart | |
*/ | |
/* | |
original source: http://www.remicorson.com/woocommerce-skip-product-cart-pages/ | |
THANKS! | |
*/ | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment