How to change the default "Return to Shop" Links to Homepage?

This topic has 6 replies, 2 voices, and was last updated 3 years, 3 months ago ago by Olga Barlow

  • Avatar: noscible
    noscible
    Participant
    January 5, 2021 at 20:57

    Hi guys,

    I have such situation. I am not using the default WooCommerce SHOP page. I just have the homepage, where I list my only three products. Thus, I want to change the links that goes to SHOP by default from woocommerce to go to my homepage. I guess, mainly they are in Cart*.php files mainly.

    Could you please help?
    Thank you,
    G.

    P.S. Does the theme support Elementor PRO? or only Free version as it is by default

    Please, contact administrator
    for this information.
    5 Answers
    Avatar: Olga Barlow
    Olga Barlow
    Support staff
    January 6, 2021 at 10:06

    Hello,

    1) It’s possible to change the mentioned links by additional customization only. Do you use child theme?

    2) XStore supports Elementor Pro. Elementor plugin authors do not have dev license for the Elementor Pro and do not allow to include it to themes, that’s why we can’t offer Elementor Pro as a bundled plugin But you can buy the personal license and use it if you need.

    Regards

    Avatar: noscible
    noscible
    Participant
    January 6, 2021 at 10:09

    Hi, thank you for the reply.

    1. Yes, I use the child theme. I activated it according to as suggest during the theme setup

    Any chance you can help with indicating where I change the code or it’s the paid service (you meant above)?

    Avatar: noscible
    noscible
    Participant
    January 6, 2021 at 16:19

    Hi Olga,

    I basically just managed changing these links for Empty Cart as well as not empty one. I changed this line: <a class="return-shop" href="<?php echo get_permalink(wc_get_page_id('shop')); ?>"><i class="et-icon et-<?php echo (is_rtl()) ? 'right' : 'left'; ?>-arrow"></i><?php esc_html_e('Return to services', 'xstore') ?></a>

    To this line

    <a class="return-shop" href="<strong>https://mywebsite.com</strong>"><i class="et-icon et-<?php echo (is_rtl()) ? 'right' : 'left'; ?>-arrow"></i><?php esc_html_e('Return to services', 'xstore') ?></a>

    and it worked!

    I just wanted to ask now – I made this change from WordPress Theme Editor in “XStore” and not in “XStore Child”, because XStore Child doesnt have any other files than functions.php and style.css. Is it a right place to change? Will update updating the XStore theme the changes stay? Please advise

    Thank you

    Avatar: noscible
    noscible
    Participant
    January 6, 2021 at 16:26

    I am sorry for spamming, but my above psot for whatever reason didn’t get posted fully.

    What I was writing is that I managed to change the links from the cart*. php files. Basically, what I changed is – for insance in case of empty-cart case:
    FROM
    <a class="return-shop" href="<?php echo get_permalink(wc_get_page_id('shop')); ?>"><i class="et-icon et-<?php echo (is_rtl()) ? 'right' : 'left'; ?>-arrow"></i><?php esc_html_e('Return to services', 'xstore') ?></a>
    TO
    <p><a class="btn" href="http://cvchopshop.co.uk/"><span><?php esc_html_e('Return To Shop', 'xstore') ?></span></a></p>

    So, it fixed and now the link is corrected.

    Though, what I wanted to ask is that – I made this changes in php files under the XStore main theme (not in child one), because XStore Child theme doesn’t have this files. It has only functions and style files.
    Is it okay to do so, and the change be saved after I update the theme to latest version?

    Thank you
    Bests,

    Avatar: Olga Barlow
    Olga Barlow
    Support staff
    January 8, 2021 at 10:31

    Hello,

    You’ll lose changes you make in the parent theme after theme update. If you need to change any functions from the parent theme use child theme.
    So, you need to copy
    xstore/woocommerce/cart/cart-empty.php to xstore-child/woocommerce/cart/cart-empty.php,
    xstore/woocommerce/cart/cart.php to xstore-child/woocommerce/cart/cart.php,
    xstore/woocommerce/loop/no-products-found.php to xstore-child/woocommerce/loop/no-products-found.php and replace Return To Shop with link you need https://developer.wordpress.org/reference/functions/home_url/ .

    Regards

  • Viewing 6 results - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.Log in/Sign up

We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.