Ready to get started?Download WordPress


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

  1. pintillo86
    Posted 3 months 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 3 months 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 3 months 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 3 months ago #

    Sry it did work! My bad!

  5. Jeremiah
    Plugin Author

    Posted 3 months 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!


You must log in to post.

About this Plugin

About this Topic


No tags yet.