WooCommerce: Put Cart & Checkout on the Same Page

This is your ultimate guide – complete with shortcodes, snippets and workarounds – to completely skip the Cart page and have both cart table and checkout form on the same page.

But first… why’d you want to do this? Well, if you sell high ticket products (i.e. on average, you sell approximately one product per order), if you want to save an additional step (two steps convert better than three: “Add to Cart” > “Cart Page” > “Checkout Page” – and this is not rocket science), if your custom workflow and ecommerce objectives require you to manage Cart and Checkout all together, well, this tutorial is for you.

There is a mix of shortcodes, settings and PHP snippets you can use to make this work out of the box. And trust me, this is easier than you think.

While many developers decide to turn the checkout process into a “Multi-Step Checkout” (ehm, not sure why – the more steps the more likely it is to have a cart abandonment), in here we’ll see the exact opposite.

So, how do they do it?

Well, here’s the complete, easy, step by step guide to put Cart & Checkout on the same page. Give it a go, do some WooCommerce testing and tracking, and see if it converts better 🙂

Step 1: Add Cart Shortcode @ Checkout Page

First, you need to add the “woocommerce_cart” shortcode to the Checkout page. In this way we’re telling WooCommerce we want to have the cart table on top and the checkout form below it.

Update: 19/Oct/2018. In the first version of this tutorial I suggested to add the [woocommerce_cart] shortcode above the “woocommerce_checkout” shortcode on the Checkout page (screenshot). Unfortunately this creates a bug on the “Thank you page” after an order is placed. In fact, an “empty cart” message is displayed there, as the Checkout page content (which includes the cart shortcode) also displays on the Thank you page (not sure why!). So we need to find a way to load the [woocommerce_cart] shortcode on the Checkout page BUT not on the Thank you page. Here’s the fix, and yes, it’s a neat PHP snippet.

PHP Snippet: Display cart table above checkout form @ WooCommerce Checkout page

 * @snippet       Display Cart @ Checkout Page Only - WooCommerce
 * @how-to        Get CustomizeWoo.com FREE
 * @author        Rodolfo Melogli
 * @compatible    WooCommerce 3.5.7
 * @donate $9     https://businessbloomer.com/bloomer-armada/

add_action( 'woocommerce_before_checkout_form', 'bbloomer_cart_on_checkout_page_only', 5 );

function bbloomer_cart_on_checkout_page_only() {

if ( is_wc_endpoint_url( 'order-received' ) ) return;

echo do_shortcode('[woocommerce_cart]');


With this tiny change, your new Checkout page will look like in the following screenshot. Please note – if you’re familiar with the Cart page layout, you might remember the “Cart Collaterals” section (i.e. “Cart Totals“, where subtotal, shipping and totals are displayed)… well, this is automatically hidden just because you’re using the two shortcodes on the same page. Isn’t this wonderful?

Cart & Checkout on Same Page: Checkout Page Preview

Step 2: Unset Cart Page @ WooCommerce Settings (Updated for Woo 3.7+)

Probably, the shortcode change alone is sufficient to get what you need (Cart and Checkout on the same page). However, a couple of tweaks are needed in case you really want to do it right.

In fact, if the Checkout is emptied (I mean, the Cart is emptied on the Checkout page), WooCommerce will redirect users to the Cart page and display the empty cart message (“Return to Shop”).

Now, our goal is to completely get rid of the Cart page so that users will never see it.

Update: 21/Aug/2019. Until WooCommerce 3.7 was possible to set the “Checkout” page as both “Cart” and “Checkout” pages. This is not possible any longer, so just follow the new instructions.

For this reason you need to unset the Cart page (under WooCommerce > Settings > Advanced) – simply click on the little “x” and “Save Changes”. Here’s the updated screenshot since WooCommerce 3.7:

Unsetting the Cart page from the WooCommerce settings (as of WooCommerce 3.7)

Step 3: Delete Cart Page @ WordPress Pages

No need of a screenshot here.

Now that the Cart page is not useful any longer, it’s time to delete it from your WordPress pages. Redirects are already in place and your cart table is already on the Checkout page, so there is no need to worry.

Go ahead and put the Cart page into the trash!

Step 4 (Bonus): Redirect Empty Checkout

Then there is a little workaround in case you don’t want to show an empty Checkout page if users access it directly or when the cart table is emptied.

For example, you might want to redirect empty carts to the homepage, or maybe to the shop page (or even better to the last viewed product), so that customers can start shopping again.

Here’s a little snippet for you – a little bonus – so you can redirect the empty checkout page to the homepage for example. Try it out!

PHP Snippet: Redirect Empty Cart @ WooCommerce Checkout with Cart

 * @snippet       Redirect Empty Cart/Checkout - WooCommerce
 * @how-to        Get CustomizeWoo.com FREE
 * @sourcecode    https://businessbloomer.com/?p=80321
 * @author        Rodolfo Melogli
 * @compatible    WooCommerce 3.5.7
 * @donate $9     https://businessbloomer.com/bloomer-armada/

add_action( 'template_redirect', 'bbloomer_redirect_empty_cart_checkout_to_home' );

function bbloomer_redirect_empty_cart_checkout_to_home() {
	if ( is_cart() && is_checkout() && 0 == WC()->cart->get_cart_contents_count() && ! is_wc_endpoint_url( 'order-pay' ) && ! is_wc_endpoint_url( 'order-received' ) ) {
		wp_safe_redirect( home_url() );

Where to add this snippet?

You can place PHP snippets at the bottom of your child theme functions.php file (before "?>" if you have it). CSS, on the other hand, goes in your child theme style.css file. Make sure you know what you are doing when editing such files - if you need more guidance, please take a look at my free video tutorial "Where to Place WooCommerce Customization?"

Does this snippet (still) work?

Please let me know in the comments if everything worked as expected. I would be happy to revise the snippet if you report otherwise (please provide screenshots). I have tested this code with Storefront theme, the WooCommerce version listed above and a WordPress-friendly hosting on PHP 7+.

If you think this code saved you time & money, please join other Business Bloomer supporters and avail of 365 days of WooCommerce benefits. Thank you in advance :)

Need Help with WooCommerce Customization?

Check out these free video tutorials. You can start learning how to customize WooCommerce without unnecessary plugins. Watch me code and learn by example!

  • how-to-edit-woocommerce-with-php-snippets
  • woocommerce-hooks-add_action-list-visual
  • woocommerce-customize-single-product-page-PHP

Rodolfo Melogli

Author, WooCommerce expert and WordCamp speaker, Rodolfo has worked as a WooCommerce freelancer since 2011. His goal is to help entrepreneurs and developers overcome their WooCommerce nightmares. Rodolfo loves travelling, chasing tennis & soccer balls and, of course, wood fired oven pizza.

115 thoughts on “WooCommerce: Put Cart & Checkout on the Same Page

  1. Rodolfo you are the man! I’ve come across several of your tutorials that have been very helpful. Thank you for contributing so much to the community.

    1. Thank you!

  2. Hey,

    I tried this, seems to be working, however, when I try to update a product quantity in cart and hit ‘update’ button, it doesnt work. is that normal?

    1. Nevermind, Didn’t know what happened but it is working now

      1. Great!

  3. Thank you, this is great! The only issue that I’ve encountered is that there is no “update cart” button. I’ve followed your instructions and the cart items show up on the checkout page, but in order to update the totals if you change the number is to press the “enter” button which is not intuitive. Is there a way to get this to show up?

    1. Emma, thanks for your comment! I just tested this again with Storefront theme and it works perfectly. Maybe your theme (or another plugin) is messing/conflicting with my snippet?

      To troubleshoot, disable all plugins but WooCommerce and also switch temporarily to “Twentyseventeen” theme (load the snippet there in functions.php) – does it work? If yes, you have a problem with your current theme or one of the plugins.

      Hope this helps!


  4. Just a little heads up; The ‘?p=19055’ page ID from the comment block returns a 404 error.
    Other than that, thanks for the clear instructions and code.

    1. Thanks for that Ronald, you were right. I’ve updated the links now. Cheers!

  5. Hi! Thanks for this, everything seems to be working perfectly so far. I have a question, shouldn’t there be an “existing customer login” section somewhere still? I noticed even with the Woo setting “Allow customers to log into an existing account during checkout” enabled I see nowhere to login to an existing account. Do we need to add that back in somehow? Thanks for any help you can give!

    1. If you allow that from the settings I don’t see why it should not show there Leslie… have you tried with a different theme maybe?

  6. Hi,
    Thanks for the code. I have my payout page on a custom page using your code. When the cart is empty or when I empty he cart, I cannot access this page. I’m always sent back to the home page (302 redirection), even when I don’t use your second snippet. Do you have an idea how to get around this.
    Thanks a lot.

    1. Hi Rich, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!

  7. Hi Rodolfo/ Ithink i found some weak point in this brilliant solution.
    1) registred & logged in buyer put smth in the cart and left the site
    2) registred & logged in byer return, he has the same products in the cart
    3) but if the products currently out of stock, he can`t put anything else in the cart
    4) he can`t remove items, the are not shown in the cart cos they are currently out of stock
    5) he can`t proceed to checkout
    6) registred & logged in byer has error message that he trying to buy outof stock items
    7) woo asks him to get back to CART page and remove the items form cart
    8) there is no CART page registred & logged in byer can`t do anything
    9) registred & logged in byer just leaving the site

    1. Thanks for reporting that Alex, I’m sure this edge case can be fixed in some way

  8. Hi Rodolfo,

    This is great! However the problem I have is that all the ‘view cart’ messages which are displayed after adding items to the cart (either on category or product page) just link to the homepage, because the cart page is no longer set. Is there a way to change them to go to the checkout page (which now also incorporates the cart)?


    1. Hi Lyall! Yes, you should look into the wc_get_page_permalink() function. It comes with a filter and therefore you can change the ‘cart’ permalink to something else. Hope this helps

      1. Thanks, I think maybe this should be added to your article? As all sites will have the same problem if the cart page is left blank in the settings as suggested…

        The closest example I’ve found regarding the function you mention is here, would this work? https://stackoverflow.com/questions/38072237/set-cart-permalink-when-cart-is-not-empty

        1. Thanks!

          1. Is there any update on how to do this? Is it possible to change the cart link throughout the site to refer to the checkout page instead? Otherwise the solution in the article doesn’t work (I tried on several of our sites).


            1. Hi Rodolfo,

              Now that version 3.8 has been released with the following changes:

              Tweak – Use wc_get_checkout_url() to get checkout URL. #24544

              Dev – Use wc_get_cart_url instead of wc_get_page_permalink( ‘cart’ ) because former has a filter woocommerce_get_cart_url to allow customization. #24530

              Is it possible to set the cart URL (the one displayed on the product page or category page after adding to cart etc.) to point to the checkout instead of always going back to homepage because the page is not set in WooCommerce settings?

              1. I’m sure it is – you need to find the piece of code that generates the notification, and then see if it offers a filter you can hook into to change the URL. I’m sure this is possible

                1. Hi Rodolfo,

                  Rather than update the links individually, is there a way to globally set the cart URL as the checkout URL, so whenever it’s referenced throughout the site it goes to the checkout?

                  1. Lyall, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!

  9. Hi,

    I followed your steps and it worked. I just have one challenge. The Cart section is duplicated on my page.

    Can you help with a workaround?

    1. Maybe you forgot to remove the cart shortcode from the page itself?

    2. I have the same issue. After deleting the snippet ” HP Snippet: Display cart table above checkout form @ WooCommerce Checkout page” it works fine, but I’m stuck with the empty cart message. Did you find a workaround in the meantime?

  10. WordPress 5.2.2
    In your screenshot, the Totals pane sits to the right of the form, but on mine it sits at the bottom leaving a huge space through the right half of the page. I tried floating it to the right but it won’t move up there automatically. I can raise it using Top: but then I’ll need to manually set it for responsiveness. How come your sits good but mine doesn’t?

    width: 50%;
    position: relative;
    float: right;
    top: 0px;

    1. Woocommerse 3.7.0

      1. It’s my theme, Storefront

  11. Hello,
    In Woocoommerce 3.7 not working 🙁

    1. I’ve updated the tutorial, let me know if it works now!

      1. Not working. redirecting to home page .

      2. Hello,
        Well it works 🙂

        But now ajax – quanity buttons not working they redirect to homepage.


        cupon in cart section redirects too homepage.

        so this:

        remove_action( 'woocommerce_before_checkout_form', 'woocommerce_checkout_coupon_form', 10 );

        needs to be removed

        and we need to remove cupon in cart section of the checkout page. But how?

  12. Hi,
    Thanks – worked perfectly!
    In woocommerce 3.7:
    “Why is it incorrect to set the Cart, Checkout and My Account pages to the same page? ↑ Back to top
    It results in incorrect redirects and broken payment gateway functionality. WooCommerce 3.7 prevents this from happening”


    I didn’t update woocommerce yet because of that. What does this mean for your solution?


    1. Not sure Ami, haven’t moved to 3.7 yet

    2. Hi,
      be carefull because last woocommerce have this surprise:

      Enhancement – Prevent the Cart, Checkout and My Account pages from being set to the same pages. #23479

      We have tested this in our dev environment, and we have not set a cart page in settings (because now this doesnt allow). As a result the “update cart” button now redirects to the index page, but the x (remove product) works well.

      I guess Woocommerce is not interest in evolving and have cart and checkout on the same page.

      Any solution to this now ?


      1. Hi there, the “update cart” redirects to the homepage only if you’re emptying the Cart (as of WooCommerce 3.7) – otherwise it works on my end. Let me know!

        1. Not work. redirect to home page .

        2. Hi,
          thanks for the update, but the “update cart” still redirects to home.
          Try to change some product quantity and press the button, and you will see.

          I guess it´s because the cart page in setup is empty.

          Thanks !

          1. Hi,
            he have added this fix to functions.php and now it seems to work, when we press the update button in 3.7.

            /* overrides cart url  to checkout url, since it has no cart page set, and to make the update button work */
            add_filter('woocommerce_get_cart_url', 'atlier_cart_checkout_override');
            function atlier_cart_checkout_override () {
                return wc_get_page_permalink( 'checkout' );

            Care to check if it´s ok, and working now ?


  13. Thank you! This is exactly what I was looking for and it looks super easy. Thought I would have to spend a day fixing this. 🙂

    1. Excellent

  14. Hi!

    I like this solution, with one exception here:

    “the “Cart Collaterals” section (i.e. “Cart Totals“, where subtotal, shipping and totals are displayed)… well, this is automatically hidden just because you’re using the two shortcodes on the same page. Isn’t this wonderful?”

    Well, I want to display “cart totals” anyway under the cart table. Why? Well, I want to show the customer what he is going to pay, with delivery fee and coupons applied.

    How can I do this?

    1. Hey Dariusz, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!

  15. Hi Rodolfo – is there a way to make this combined cart/checkout page work with WooCommerce product dependencies (https://wordpress.org/plugins/woocommerce-product-dependencies)?

    Right now if a customer adds a dependent product and proceeds to the combined cart/checkout, an error is displayed due to the product dependency not being met (“There are some issues with the items in your cart. Please go back to the cart page and resolve these issues before checking out.”). There is then a link to “Return to Cart”, which obviously redirects to the combined cart/checkout with the same error message (ie. it loops).

    Is there a way to force the validation to occur on the combined cart/checkout page, so the dependency notice error appears on top of the cart on the combined cart/checkout page, as with coupon code additions and other notices?

    1. Hi Robyn, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!

  16. HI,

    I was on a similar not I was wondering how to make a single page checkout: product page and checkout page all on one page. So that would work for donations.

    Thank you.

    1. Hello there, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!

  17. Hey. Great post and all makes sense.

    apart from I can’t work how to edit/personalise the code snippet you’ve shared

    add_action( ‘woocommerce_before_checkout_form’, ‘bbloomer_cart_on_checkout_page_only’, 5 );

    function bbloomer_cart_on_checkout_page_only() {

    if ( is_wc_endpoint_url( ‘order-received’ ) ) return;

    echo do_shortcode(‘[woocommerce_cart]‘);


    In this you’ve used the bloomer credentials but how do I find the exact path/description to use for my own domain/website?

    1. Hi Ryan, that’s only how I name PHP functions, you can leave them as-is or you can use whatever name you like 🙂

  18. Hey Rodolfo – thanks for the snippet! Super helpful 🙂 Just wondering if you have any ideas why the snippet, which inserts the cart using the WooCommerce shortcode, inserts a non-responsive version of the cart? Any way to ensure that when adding the cart above the checkout it inserts a responsive cart?

    1. Hi Robyn, I guess you need to add some custom CSS to fix that 🙂

  19. Hi Rudolpho,
    thank you so much for this snippet. I have an add occurance though. When I refresh the page (after doing all of your steps) the fields for “Different shipping address” show up filled with the billing address details. Any ideas?

    1. Classic Autocorrect, please forgive me the wrong spelling of your name, Rodolfo!

      1. No problem Tobi 🙂 I just retested this on the latest version of WooCommerce and it still works. Unfortunately this looks like custom troubleshooting work and I cannot help here via the blog comments. Thanks a lot for your understanding! ~R

  20. Hello…my cart is displayed incorrectly, it is too big and does not look like the original cart page is not responsive on the phone. What is the cause ?

    1. Not sure Martin, maybe you need to adjust some CSS?

  21. I`ve recovered one bug within ur method. When it happends that customer has more items in cart than u got in stock, system asks to return to the cart page and reduce the amount of items, but thre is no cart page anymore, so it loops. And there is noway to solve this in fronend.

    1. Hey Aleks, thanks for your comment. I understand this but it’s a very specific issue so I can’t fix this for now. If you find a solution let me know 🙂

  22. hello again,

    I have just one problem with your great code. You are saying:
    “you might remember the “Cart Collaterals” section (i.e. “Cart Totals“, where subtotal, shipping and totals are displayed)… well, this is automatically hidden just because you’re using the two shortcodes on the same page. Isn’t this wonderful?”

    But the problem is that when using “WooCommerce PayPal Checkout Payment Gateway” By WooCommerce, the yellow Paypal Express button is usually displayed on this part of the /cart/ page that we do not see anymore.
    So now your new /checkout/ page has no yellow Paypal express button.

    Do you know how we can do to add “Cart Collaterals” again or just the Paypal yellow button on top of your new checkout page?

    Thanks again for all !

    1. Hi there, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!

    2. I am looking exactly for this too, how did you solve it at the end? I also need to display the Paypal express button under the cart.

  23. Hello! that’s great and works well for me. The only thing is that I get at the top of the cart section – The box for the coupon code, and then just before the billing – as part of the check out section, I get another opportunity to add the coupon code…
    “Have a coupon? Click here to enter your code”

    Can I removed the “Have a coupon? Click here to enter your code” section and only have the box for the coupon at the top?

    If yes, how?



    1. Hello Laura thanks for your comment! Yes, check this: https://businessbloomer.com/woocommerce-visual-hook-guide-checkout-page/

  24. yesssss! Finally I’ve found a tutorial explaining this. Many many thanks Rodolfo!!!

    1. Brilliant 🙂

  25. I have a problem. If I am in the cart and update the quantity of a product, but the maximum availability has been reached, it shows the woocommerce-error message twice. How can I solve this?

    1. Fabian, thanks so much for your comment! Yes, this is possible – but unfortunately this is custom work and I cannot provide a complementary solution here via the blog comments. Thanks a lot for your understanding! ~R

    2. Ok, I understand (maybe just a hint? ;). Anyways, thanks for your awesome site. First time WooCommerce user here and your site is giving a lot of useful informations. Thanks for your work.

      1. Thank you so much Fabian! I would do a file search through the WooCommerce plugin files to see how the message is generated – after that, I would find a way to edit or disable the notification via a PHP snippet. This is all I can say – good luck 🙂

  26. FYI
    The script for auto-updating the cart does not work when using a combined cart and checkout even if you change it to include cart && checkout. Might be worth updating that as well since this has been updated?

    1. Thanks for that Peter, I’ll see what I can do

  27. Thanks Rudolfo, I have heard a lot about putting the checkout on the same page as product listings, but not about adding the cart as well. This is a good solution for people wanting to be able to edit product quantities and remove products from the cart on the one-page checkout.

    A lot of people will want to use this method with a list of products above so that customers can implement true one-page ordering, in which they choose products and complete their order from a single page. You can use this method with the WooCommerce Product Table plugin to list the products above the cart and checkout. Would you like me to send you an extra paragraph about this to include in your article, as I think it will be of interest to a lot of you readers?

    1. Thanks for your input, Katie, much appreciated 🙂

  28. Hi Rodolfo, thanks for this awesome trick !
    One thing I regret is that when going to an empty cart we don’t have the nice “Return to shop” button.
    You used the condition : if ( is_wc_endpoint_url( ‘order-received’ ) ) return;
    is their another one that could be added to be used in case of empty cart ?


    1. Thanks Thibault! The second part of the snippet redirects to a given page, so you could redirect to the shop 🙂

  29. Rodolfo! You surprise us with a gem in every newsletter. I’m doing this on a live site–it’s exciting! 🙂

    One cosmetic problem I have: upon clicking Checkout, Checkout page loads with Cart at the top but the billing address fields are visible. So the customer has to scroll up to see the coupon message and the cart above it. The links point to /checkout/ but the page is not loaded to be at the top. Can my theme (Divi) mess with the load position?

    1. Thanks Peter! Simply switch theme temporarily and try that again – then let me know 🙂

  30. Hi and thank you for the code!
    There is one thing that I don’t understand. When I entered your main code there is a code


    still showing up in checkout page. How can I make it dissapears. I hope you understand my poor english.
    Best regards

    1. Hi there, thanks for your comment! Please substitute “enter_here_woocommerce_cart_shortcode_here” with “woocommerce_cart” 🙂

  31. Hi Rodolfo,

    Congrats for your posts! best on the web for woocommerce ! learned a lot !

    There is a problem on my side when i send a pay for order email (sometimes customer has problem to pay and we have to send a payment link). It gets redirected to home page, instead of payment page. To fix, i added pay endpoint to exclude it from conditions to redirect to home page:

    function bbloomer_redirect_empty_cart_checkout_to_home() {
        if ( !is_wc_endpoint_url( 'order-pay' ) && is_cart() && is_checkout() && 0 == WC()->cart->get_cart_contents_count() ) {
            wp_safe_redirect( home_url() );

    it works on my end, hope it’s correct for everybody.

    1. That’s awesome Julio 🙂 Thank you!

  32. On a dev site, with this solution (all steps) in place, I’m still getting the cart page. And on the checkout page I’m getting two cart tables above the billing area. Looking deeper into this site’s plugins and other configs but thought I’d mention it doesn’t work out of the gate for every site.

    1. Hey Rob, thanks for your comment 🙂 This works so there is something else conflicting with it. So, it’s possibly your theme. Try to swithùch temporarily to 2017, apply the snippets, and it should work – in that case you’ll know there is something wrong in your theme or the coding needs to be adjusted for your custom coding

  33. One much waited snippet here. Thanks a lot ! 🙂

    1. Excellent 🙂

  34. Ooo just noticed something.. with the removal of the cart page, something occurs.

    A user buys something and goes to the “new” checkout – what if they want to add more? or if they want to add another item? or simply add to the existing product count – all that is no longer available.

    This is an interesting curve ball

    1. Hey Roberta, yes, make sure to add the Cart shortcode above the Checkout form. Please use the PHP way (tutorial now updated) and not the manual way, otherwise you will have an “empty” cart notice on the thank you page. Cheers 🙂

  35. This is brilliant! I have a theme where the cart icon is in the menu – and this still works even with this change. I am hoping the streamlined process will improve conversions. Thank you.

    1. Awesome 🙂

  36. Thank you Rodolfo!
    It works, but now there is no option to remove items added to checkout
    If someone added by mistake 3 items instead of 2, he cannot modify the order as he was able in the shopping cart.
    How can I overcome this problem?

    1. Ciao Ugo, thanks for your comment! As you can see from the screenshots, my checkout displays the little red “X” buttons to remove items and also the quantity selectors, as well as the “update cart” button. So, you probably have some other problem / conflict 🙂

  37. Hi, great hack.

    Can we do something about this message on the checkout page after the order is made?



    1. You’re absolutely correct Cristian – let me find a different solution. Be right back!

      1. Tutorial updated 🙂

    2. Good question, and I didn’t see the answer. Could you clarify how this can be done?

  38. Great little tweak.
    We love your work.

    1. Thanks Bob 😀

  39. Rodolfo,

    Thanks for the explanation. I really like how this functions, however it breaks some custom code I have. I have a coupon code programmatically added to the cart on multiple quantities of certain products being added. My PHP leverages the following:

    WC()->cart->add_discount( $coupon1 );

    Putting the cart and checkout short codes on the same page breaks this function. I get the notice that the code has been added, but the discount is not reflected in the checkout totals. Any suggestion on how to modify my custom function to apply the coupon codes if the checkout and cart are on the same page?

    1. Hello grant, thanks so much for your comment! Yes, this is possible – but unfortunately this is custom work and I cannot provide a complementary solution here via the blog comments. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding! ~R

    2. I’d like to piggyback off this. For me it shows the discount in the checkout totals, but when code is applied it doesn’t show discounted price in the cart itself – while it did before. Rodolfo, is discount applied properly on your end in the cart section after coupon is added?

      1. Hey Miroslav 🙂 Yes, despite the “Cart Totals” are gone, if I scroll down to the Checkout Order Review table I see the coupon row once I add a valid coupon, together with the discount applied. Hope this helps!

  40. Ohh I’m so trying this on my shop tomorrow! Thanks so much for sharing all your knowledge 🙂

    1. Excellent 🙂

  41. Crazy bug great tip Rodolfo 😉

    Hugs from Spain

    1. Thanks a million Fernando! Same to you 🙂

  42. That’s a good idea, but what happens to the shipping options (calculate shipping option on the cart page) – where do these get selected?

    1. Hey Lyse, thanks for your comment! Shipping options are inside the checkout form shipping total, so no need of a shipping calculator 🙂

  43. This is really useful if you have multiple items.

    In another scenario, what if there was only one item for sale, could this all be added to the single page or template?

    That way you go to the product and simply add it and go through the purchasing process right there…

    I’ve seen single product themes use that methodology (then it woul be applied to the current theme in use)

    1. Hello Roberta, thanks so much for your comment! You could totally try to add the “woocommerce_checkout” shortcode inside the single product page and see what happens 🙂

  44. “even better to the last viewed product” How do I do this ?

    1. Hey Alain, thanks so much for your comment! Yes, this is possible by using a WordPress function called “wp_get_referer()” – unfortunately this is custom work and I cannot provide a complementary solution here via the blog comments. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding! ~R

  45. Hi Rudolfo

    That looks a REALLY useful idea. Thank you!

    If I wanted to redirect to another page other than the home page, how should I insert its URL in your snippet line:

    wp_safe_redirect( home_url() );

    Many thanks


    1. Thank you Garry 🙂

      You’d use something like:

      wp_safe_redirect( 'https://your-custom-url.com' );

      Let me know

Questions? Feedback? Support? Leave your Comment Now!

If you are writing code, please wrap it between: [php]code_here[/php]. Failure to complying with this (as well as going off topic) will result in comment deletion. You should expect a reply in about a week - this is a popular blog but I need to get paid work done first. Please consider joining #BloomerArmada to ask me 1-to-1 WooCommerce questions. Thank you :)

Your email address will not be published. Required fields are marked *