Add a ‘Continue Shopping’ Button to Woo Commerce Checkout and Cart Page

By default WooCommerce Cart page does not have a ‘Continue Shopping’ or ‘Return to Store’ button. However if you go to the cart page when the cart is empty, there is a  ‘Return to Store’ button.

We just need to add this button code to the cart page when the cart has items.

 

add_action('woocommerce_cart_actions', function() {
  ?>
  <a class="button wc-backward" href="<?php echo esc_url( apply_filters( 'woocommerce_return_to_shop_redirect', wc_get_page_permalink( 'shop' ) ) ); ?>"> <?php _e( 'Return to shop', 'woocommerce' ) ?> </a>

  <?php
});

 


8 Comments

  • Jennifer

    August 27, 2019

    can you tell me which woocomm php file to add this to?

    Reply
  • Randy Holcomb

    November 13, 2019

    So, where is it that I add this snippet?

    Reply
    • LWD

      November 14, 2019

      You’ll need to add it to your theme’s functions.php file

      Reply
  • Sean

    April 4, 2020

    That’s perfect, but can you have it go back the the last selected Category instead, not just the shop page?

    Reply
  • Alex

    May 14, 2020

    works great! But if I want to position it so that it is next to proceed to checkout?

    Reply
  • Mitzii

    November 13, 2020

    Worked like a charm, thank you. I added another class so I could tweak the CSS a bit.

    Reply
  • Ollie

    April 20, 2021

    Thanks for sharing this, I’ve used it and it works as of this day.

    Reply
  • Zsofi

    June 2, 2021

    Thanks, it’s very helpful. 🙂

    Reply

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.