WooCommerce Menu Cart
[resolved] Chnage empty cart link (8 posts)

  1. pintillo86
    Posted 2 years ago #

    Hello I'm currently using a shop page which link is store, not shop, but when the cart is empty and you click it, it takes to a page with shop that is not currently been used, how can I change this?


  2. Jeremiah
    Plugin Author

    Posted 2 years ago #

    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.

  3. pintillo86
    Posted 2 years ago #

    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
    <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>
  4. pintillo86
    Posted 2 years ago #

    Sry it did work! My bad!

  5. Jeremiah
    Plugin Author

    Posted 2 years ago #

    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!

  6. Solar-Plexus
    Posted 1 year ago #


    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?

  7. daroosta
    Posted 1 year ago #

    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?

  8. Jeremiah
    Plugin Author

    Posted 1 year ago #

    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.



Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WooCommerce Menu Cart
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic


No tags yet.