This topic has 12 replies, 3 voices, and was last updated 3 years, 8 months ago ago by Robert Hall
Hi, I have a specific page for my store that is not the default woocomerce, I would like to be able to link to that page when I click the return to store button, I have been looking online and I have found a code that has worked for me in others web but not in this one.
the code is the following.
/ **
* Changes the redirect URL for the Return To Shop button in the cart.
*
* @return string
* /
function wc_empty_cart_redirect_url () {
return ‘https://www.cuentosenlacabeza.com/nuestra-libreria/’;
}
add_filter (‘woocommerce_return_to_shop_redirect’, ‘wc_empty_cart_redirect_url’);
I have put it in the functions.php of my child theme.
If you could help me
Hi,
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
Hello I have copied the codes but I don’t know how to add the url to the last code, I don’t know where I should add my custom url https://www.cuentosenlacabeza.com/nuestra-libreria/
if you could help me thanks
this is the code where retum to shop appears
<?php esc_html_e('Check your spelling or search again with less specific terms.', 'xstore') ?>
<a class="btn black medium" href="<?php echo get_permalink(wc_get_page_id('shop')); ?>"><span><?php esc_html_e('Return To Shop', 'xstore') ?></span></a>
Hello,
Just add the link like here – http://prntscr.com/10y4g2k
<p><a class="btn black" href="https://www.cuentosenlacabeza.com/nuestra-libreria/"><span><?php esc_html_e('Return To Shop', 'xstore') ?></span></a></p>
Regards
it still doesn’t work if they could check it on the web please. Thanks
Hello,
It looks like you have changed wp-admin access http://prntscr.com/10yq1ju
.php files should be edited via FTP, not Dashboard.
Additional customization in files is outside the scope of our basic support.
Regards
Good morning the files I am editing them from the file manager of my accommodation, I attach an image, but it still does not work, it continues to lead to the default woocomerce page.
https://www.dropbox.com/s/fectvs03uqpkvuh/imagen.jpg?dl=0
Hello,
It looks like you provided a wrong screenshot.
As I can see, your changes work here – http://prntscr.com/10yygg2 and http://prntscr.com/10yyhg7 Clear cache and check. About this link – http://prntscr.com/10yyllu , you did not change it in xstore-child/woocommerce/cart/cart.php.
About the link here – http://prntscr.com/10yyole , re-write etheme_get_mini_cart_empty function (xstore/framework/woo.php file) via functions.php file of the child theme.
Regards
About the link here: http://prntscr.com/10yyole, rewrite the etheme_get_mini_cart_empty function (xstore / framework / woo.php file) through the functions.php file of the child theme.
I do not understand this part what should I do? If you could tell me a little more detailed the steps please.
Read this article – https://developer.wordpress.org/themes/advanced-topics/child-themes/#using-functions-php
Just add the next code in functions.php of your child theme:
if ( ! function_exists( 'etheme_get_mini_cart_empty' ) ) {
function etheme_get_mini_cart_empty(){
?>
<div class="woocommerce-mini-cart__empty-message empty">
<p><?php esc_html_e( 'No products in the cart.', 'xstore' ); ?></p>
<?php if ( wc_get_page_id( 'shop' ) > 0 ) : ?>
<a class="btn" href="https://www.cuentosenlacabeza.com/nuestra-libreria/"><span><?php esc_html_e('Return To Shop', 'xstore') ?></span></a>
<?php endif; ?>
</div>
<?php
}
}
Regards
great now if it works thanks
Hello
Thank you so much for your kind words.
If you have any other issue in this theme package let us know we are always here to provide you customer support.
Robert Hall
You must be logged in to reply to this topic.Log in/Sign up