Viewing 11 replies - 1 through 11 (of 11 total)
  • Hello,

    add this to your theme functions.php file.

    add_filter( 'woocommerce_continue_shopping_redirect', 'change_continue_shopping_redirect' );
    function change_continue_shopping_redirect() {
      return home_url();
    }
    Thread Starter Myra

    (@sitesandsearch)

    Thank for your reply.

    When I add this to the functions.phhp (child theme)I get the following error:

    Parse error: syntax error, unexpected T_FUNCTION in /public/sites/www.website.com/wp-content/themes/legenda-child/functions.php on line 9

    Thread Starter Myra

    (@sitesandsearch)

    The current php codes with continue shopping is:

    <?php if (class_exists('WooCommerce')) {
                        global $woocommerce;
                        ?>
                            var checkoutUrl = '<?php echo esc_url( $woocommerce->cart->get_checkout_url() ); ?>';
                            var contBtn = '<?php _e('Continue shopping', ETHEME_DOMAIN) ?>';
                            var checkBtn = '<?php _e('Checkout', ETHEME_DOMAIN) ?>';
                        <?php

    I don’t understand what is the code you posted.

    paste my code at the end of the file – blank space.

    Thread Starter Myra

    (@sitesandsearch)

    I pasted your code in the (still empty) functions.php in my child theme. Not ok?

    OK, but the code you posted here it’s not my code.

    the error saying you pasted wrong and in LINE 9, so it cause a syntax error.
    line 9 it’s not at the end of the file.

    try again.

    Thread Starter Myra

    (@sitesandsearch)

    Wow now it works! Thank you!

    But.. the shop is not on my homepage. Can I use a specific URL instead return to home? The page is website.com/shop

    Regards, Myra

    change

    return home_url();

    to

    return 'https://www.example.com';

    Hi @myra, you can paste below code:

    add_filter( 'woocommerce_continue_shopping_redirect', 'tt_woocommerce_continue_shopping_redirect', 20 ); 
    
    function tt_woocommerce_continue_shopping_redirect( $return_to ) {
      return get_permalink( woocommerce_get_page_id( 'shop' ) );
    }
    Thread Starter Myra

    (@sitesandsearch)

    @yehudah, you made my day! Thank you!

    Your welcome.

    @terrytsang, this question all ready answered.
    Thanks for trying.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Change link of button’ is closed to new replies.