Join

Skip Cart and Go Directly to Checkout

Don't want to mess with code snippets? Request for this to be a feature of MyListing Pro.

Instructions

  1. Create a new PHP code snippet.
  2. Copy the contents of code snippet below.
  3. Paste the contents into your code snippet.
  4. Review any notes that I’ve provided.
  5. Save and enable the code snippet.
  6. Test.

Snippet

After a product is added to the cart, the shopper is sent straight to checkout instead of staying on the product page or going to the cart.

PHP
add_filter("add_to_cart_redirect", "wptu_add_to_cart_redirect");
function wptu_add_to_cart_redirect()
{
    global $woocommerce;
    $wptu_redirect_checkout = $woocommerce->cart->get_checkout_url();
    return $wptu_redirect_checkout;
}