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 });
Jennifer
August 27, 2019can you tell me which woocomm php file to add this to?
Randy Holcomb
November 13, 2019So, where is it that I add this snippet?
LWD
November 14, 2019You’ll need to add it to your theme’s functions.php file
Sean
April 4, 2020That’s perfect, but can you have it go back the the last selected Category instead, not just the shop page?
Alex
May 14, 2020works great! But if I want to position it so that it is next to proceed to checkout?
Mitzii
November 13, 2020Worked like a charm, thank you. I added another class so I could tweak the CSS a bit.
Ollie
April 20, 2021Thanks for sharing this, I’ve used it and it works as of this day.
Zsofi
June 2, 2021Thanks, it’s very helpful. 🙂