-
AuthorPosts
-
August 19, 2018 at 5:44 pm #998997
I am using a different page for my shop and want to change the href for the “return to shop” button that comes with woocommerce. Is this something I can do within the enfold theme?
Thanks!August 19, 2018 at 5:51 pm #998999Hey kpcradix!
Use this code to change the back to shop cart url:
/** * Changes the redirect URL for the Return To Shop button in the cart. * * @return string */ function wc_empty_cart_redirect_url() { return 'http://mywebsite.com/sample-page/'; } add_filter( 'woocommerce_return_to_shop_redirect', 'wc_empty_cart_redirect_url' );and replace http://mywebsite.com/sample-page/ with the url of the page you want to redirect to.
You can insert it into the functions.php of your child theme. If you don’t use a child theme I’d recommend to create a small plugin, otherwise the code will be removed on every theme update.
You can use this code for the plugin:
<?php /* Plugin Name: Enfold Custom Code Description: Enfold Custom Code Version: 1.0 Author: InoPlugs Plugin URI: https://inoplugs.com Author URI: https://inoplugs.com */ /** * Changes the redirect URL for the Return To Shop button in the cart. * * @return string */ function wc_empty_cart_redirect_url() { return 'http://mywebsite.com/sample-page/'; } add_filter( 'woocommerce_return_to_shop_redirect', 'wc_empty_cart_redirect_url' );– replace http://mywebsite.com/sample-page/, then save it to a text file with the extension .php (i.e. enfold_custom_code.php).
Then upload this text fiele to wp-content/plugins/. Afterwards go to the wordpress admin panel > Plugins and activate the new plugin.
Best regards,
PeterAugust 19, 2018 at 5:57 pm #999002Peter you are awesome! .. but I’ve never created a plug-in before and I’m not familiar with php. I will give it a try though and get back if I have any trouble with your instructions.
Thanks!!August 19, 2018 at 6:05 pm #999005Hi,
Ok, I’ll leave this thread open.
Best regards,
DudeAugust 20, 2018 at 8:20 am #999201The instructions to create a plug-in worked like a charm. Thanks again Peter!!
August 20, 2018 at 8:37 am #999209Hi,
Great, glad I could help you :)
Best regards,
Dude -
AuthorPosts
- The topic ‘Change link for "return to shop" button in woocommerce cart’ is closed to new replies.
