• I added this code to my functions.php, and it works great, I get a “continue shopping” text link on the cart page.

    BUT, the client says they want it to return to the previous page, not go to a fixed URL (in this case, the Shop page).

    I’ve tried EVERYTHING to get this to work, and I can’t. Any ideas?

    CODE I ADDED AND WORKS:

    add_action( ‘woocommerce_before_cart_table’, ‘woo_add_continue_shopping_button_to_cart’ );

    function woo_add_continue_shopping_button_to_cart() {
    $shop_page_url = get_permalink( woocommerce_get_page_id( ‘shop’ ) );
    echo ‘<div class=”woocommerce-message”>’;
    echo ‘ Continue Shopping → Need some more products?’;
    echo ‘</div>’;
    }

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thanks @graphikjam

    I’ve been searching for something like this, I’ll take a look soon!

    function woo_add_continue_shopping_button_to_cart() {
    $shop_page_url = get_permalink( woocommerce_get_page_id( 'shop' ) );
    echo '<div class="woocommerce-message"><a href="javascript:javascript:history.go(-1)">';
    echo ' Continue Shopping → Need some more products?';
    echo '</a></div>';
    }
    add_action( 'woocommerce_before_cart_table', 'woo_add_continue_shopping_button_to_cart' );
    • This reply was modified 8 years, 5 months ago by DeeperLook.
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Adding "go back" button/link to the Woo cart page’ is closed to new replies.