Before you ask please READ THIS

Add "Go back to shop" button on single product page

in FatMoon Posts: 199
Hello

When I click on a product on my shop page I miss a "back to shop" button. Is there an easy way to add this to my single products.

Thanks, Pascal
Bildschirmfoto 2016-11-09 um 12.34.04.png
1606 x 1247 - 329K

Comments

  • AirAir
    Posts: 9,868
    Hello there:-)

    You can try solution from woocommerce support https://wordpress.org/support/topic/add-continue-shopping-button-to-product-pages/

    With kind regards.
  • edited November 2016 Posts: 199
    Hi

    Thanks for the Link.. I actually found something even better (I wanted a button :)) and I'm almost happy now... the only problem I have is placing the button in the right place!

    I used this code
    
    //add back to store button after cart
    add_action('woocommerce_single_product_summary', 'themeprefix_back_to_store');
    function themeprefix_back_to_store() { ?>
    <a class="button wc-backward" href="<?php echo get_permalink( wc_get_page_id( 'shop' ) ); ?>"><?php _e( 'Return to Store', 'woocommerce' ) ?></a>
    <?php
    }
    
    Maybe putting it where I want is an easy thing for you? (see screenshot)

    Using a textlink for that puts it in the right place:
    add_action( 'woocommerce_single_product_summary', create_function( '', 'echo "<a href=\"YOUR_SHOP_PAGE_URL\">Continue Shopping</a>";' ), 35 );

    Thank you
    Pascal
    Bildschirmfoto 2016-11-10 um 12.32.28.png
    1435 x 1114 - 253K
    Post edited by Air on
  • AirAir
    Posts: 9,868
    Sorry for late reply, I must have missed your answer :-S

    Change this code from your original code
    add_action('woocommerce_single_product_summary', 'themeprefix_back_to_store');
    to
    add_action('woocommerce_single_product_summary', 'themeprefix_back_to_store', 35);

    It should work ;-)

    With kind regards.
  • Posts: 199
    Hi there

    Thanks.. that worked like a charm :))
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!