Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Contributor Jeremiah

    (@jprummer)

    Hi there! You can change that with a filter. Just add the following to your theme’s functions.php file and change the $empty_url variable to be whatever you need.

    /**
     * Set page url when cart is empty
     */
    add_filter('wpmenucart_emptyurl', 'add_wpmenucart_emptyurl', 1, 1);
    function add_wpmenucart_emptyurl ($empty_url) {
    	$empty_url = 'https://yoursite.com/empty';
    	return $empty_url;
    }

    Also note that if you’re using this with WooCommerce, you may just need to update your shop page in the WooCommerce settings as our plugin uses the page specified in your settings.

    Thread Starter pintillo86

    (@pintillo86)

    Hmmm didn’t work!
    please see my site so you can see what I’m saying http://www.beefitcr.com/store/
    Go there and click the menu bar cart to see where it takes, I want it to redirect to the same page as if you click on the menu “Mi Carrito”

    I actually have no page set on the woocommerce settings, because it will mess up my store, I’m using Theme Divi from Elegnat Themes.

    This is what I’m using in my empty-cart.php file in case it helps.

    if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
    
    wc_print_notices();
    
    ?>
    
    <p class="cart-empty"><?php _e( 'Your cart is currently empty.', 'woocommerce' ) ?></p>
    
    <?php do_action( 'woocommerce_cart_is_empty' ); ?>
    
    <p class="return-to-shop"><a>"><?php _e( 'Return To shop', 'woocommerce' ) ?></a></p>

    Thread Starter pintillo86

    (@pintillo86)

    Sry it did work! My bad!

    Plugin Contributor Jeremiah

    (@jprummer)

    No worries man! You were probably a victim of caching. For anyone else reading this, be sure you close all tabs and reopen. Enjoy the plugin!

    Hi,

    I’ve included the snippet provided above in my functions.php (and emptied the cache numerous times) but it didn’t work till now unfortunately ;(

    Any thoughts?

    I have added this plugin to my functions file and it works except now when there ARE products in the cart it’s causing the cart link to link to the page you’re on currently. Any ideas on this?

    Plugin Contributor Jeremiah

    (@jprummer)

    Hi daroosta!

    Can you open a new thread for this? In it include a link to your site so we can take a closer look.

    Thanks!

    Jeremiah

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Chnage empty cart link’ is closed to new replies.