Work Services Journal About Contact
Warsaw [email protected]

How to Redirect to Checkout with WooCommerce in Elementor

Skipping the cart page and sending customers straight to checkout is a reliable way to shorten a WooCommerce funnel, especially for single-product or low-SKU stores. I have set this up on client shops many times. The one-line version you see in most tutorials is not enough on its own, so here is the complete, still-current recipe: disable AJAX, redirect, handle the edge cases, and tidy the messaging.

Step 1: turn off AJAX add to cart

Go to WooCommerce > Settings > Products and uncheck Enable AJAX add to cart buttons on archives. AJAX adds the product without a page load, which is exactly what you do not want when the whole point is to move the customer to checkout. With it off, adding a product triggers a real redirect the next steps can hook into.

Step 2: redirect to checkout after add to cart

This is the core snippet. Add it in the Code Snippets plugin rather than functions.php, so a theme update cannot wipe it:

add_filter( 'woocommerce_add_to_cart_redirect', 'lv_skip_cart_redirect_checkout' );
function lv_skip_cart_redirect_checkout( $url ) {
  return wc_get_checkout_url();
}

wc_get_checkout_url() always returns the correct checkout URL for your store, so you never hardcode a page ID that could change.

Step 3: fix "sold individually" products

Here is the edge case the short tutorials skip. If a product is set to Sold individually and it is already in the cart, clicking add to cart again throws an error instead of moving on. The fix is to intercept the add to cart URL: if the item is already in the cart, point the button straight at checkout.

add_filter( 'woocommerce_product_add_to_cart_url', 'lv_fix_for_individual_products', 10, 2 );
function lv_fix_for_individual_products( $add_to_cart_url, $product ) {
  if ( $product->get_sold_individually()
    && WC()->cart->find_product_in_cart( WC()->cart->generate_cart_id( $product->get_id() ) )
    && $product->is_purchasable()
    && $product->is_in_stock() ) {
    $add_to_cart_url = wc_get_checkout_url();
  }
  return $add_to_cart_url;
}

I have updated the original snippet to use $product->get_id() instead of the old $product->id property, which is the current, correct way to read a product ID in WooCommerce.

Step 4: remove the "added to your cart" notice

With customers landing on checkout, the "The product has been added to your cart" notice looks out of place. Remove it:

add_filter( 'wc_add_to_cart_message_html', 'lv_remove_add_to_cart_message' );
function lv_remove_add_to_cart_message() {
  return '';
}
The one-line redirect is the famous part. The sold-individually fix and the message cleanup are what make it feel finished.

Want a WooCommerce checkout flow that actually converts, edge cases and all? Get in touch.

Let’s build

Have a project in mind?

Get in touch