• Woocommerce version: 2.2.11
    I was having problems with how Woocommerce was displaying products in my shop, so I’ve created a new page to use for my Woocommerce shop and named it Store. I added the following shortcode to the page.

    [products columns=”3″ orderby=”title” order=”asc”]

    The page has a right sidebar, and I added a text widget to the sidebar with this shortcode:

    [product_categories ids=”15, 16, 17″]

    Everything works great, and my Store page is cleaner and works better than the Shop page created by Woocommmerce. I simply removed the ‘Shop’ page from the menu and replaced it with my ‘Store’ page – so users should never see the Shop page.

    My problem is when you go to the Cart page and the cart is empty, there is a button that is labeled: ‘Return to Shop’ – which takes you to the Woocommerce ‘Shop’ page, but I need to change that to re-direct back to my custom Store page. Any ideas how to change to re-direct?

    https://wordpress.org/plugins/woocommerce/

Viewing 7 replies - 1 through 7 (of 7 total)
  • plugins -> woocommerce -> templates -> cart -> cart-empty.php

    Editing the link is pretty self-explanatory.

    I did the same thing with mine, but routed the button to the “My Account” page.

    Also, keep in mind this will get erased if/when you ever update woocommerce.

    I’m not sure how you’d go about doing it via a hook in your functions.php file.

    Thread Starter RoamingPro

    (@roamingpro)

    Yes, I looked at that template – hard coding the link in there would be the easiest. I already created a child-theme for this project, so getting the code overwritten wouldn’t be a problem.

    Thanks, this would solve my problem as well.

    Can you give me and the next person an example of how to change that link?

    It uses the get_permalink function, followed by “wc_get_page_id” instead of “get_page_id”

    If I change shop to something else, it doesn’t open the page.
    If I replace wc_get_page_id with get_page_id, the button disappears all together.

    get_permalink( wc_get_page_id( ‘shop’ )

    Thank you! (and sorry for hijacking this post, I don’t want to open up another one, if one exist already)

    Here is the original line:

    <p class="return-to-shop"><a class="button wc-backward" href="<?php echo apply_filters( 'woocommerce_return_to_shop_redirect', get_permalink( wc_get_page_id( 'shop' ) ) ); ?>"><?php _e( 'Return To Shop', 'woocommerce' ) ?></a></p>

    Here is my line:

    <p class="return-to-shop"><a class="button wc-backward" href="/my-account/"><?php _e( 'My Account', 'woocommerce' ) ?></a></p>

    So basically you’re replacing

    <?php echo apply_filters( ‘woocommerce_return_to_shop_redirect’, get_permalink( wc_get_page_id( ‘shop’ ) ) ); ?>

    with whatever link you want.

    Thank you very much, that works like a charm! 🙂

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Replacing Woocommerce Shop Page with Custom Page’ is closed to new replies.