A simple, powerful and independent e-commerce platform.
Sell anything with ease.

Skip cart and go straight to checkout

On some sites a cart may be completely unnecessary. You may only have one product and the quantity selector might be superfluous. Forcing the customer to go through the cart page is pointless step and just adds another step where you might lose the sale.

First disable the cart in Classic Commerce > Settings > Products.

Then add these few lines of code to skip the cart and go straight to the checkout page. Note that the text on the button that normally says “Add to cart” will need to be modified as well. The code below changes it to “Buy Now”.

/**
 * Skip cart and go straight to checkout
 */

// Takes user straight to checkout page when an item is selected from the store.
// Changes 'Add to cart' text on buttons.
// https://wpbeaches.com/skip-cart-go-straight-to-checkout-page-in-woocommerce/

add_filter('woocommerce_add_to_cart_redirect', 'cc_add_to_cart_redirect');

function cc_add_to_cart_redirect() {
  global $woocommerce;
  $checkout_url = wc_get_checkout_url();
  return $checkout_url;
}

//Add 'Buy Now' button text on single product page and other locations

add_filter( 'woocommerce_product_single_add_to_cart_text', 'cc_cart_button_text' ); 
add_filter( 'woocommerce_product_add_to_cart_text', cc_cart_button_text' ); 
 
function cc_cart_button_text() {
  return __('Buy Now', 'woocommerce');
}
View Raw Code ID: 2501