WordPress.org

Forums

WooCommerce Menu Cart
[resolved] Change text of empty cart (6 posts)

  1. mottersland
    Member
    Posted 1 year ago #

    Is there a way to change the default "Empty Cart" text to something like "Go to webshop", and then as you add to basket it changes back to your subtotal ?
    Cheers!

    https://wordpress.org/plugins/woocommerce-menu-bar-cart/

  2. Ewout
    Member
    Plugin Author

    Posted 1 year ago #

    Hello Mottersland,
    Can you explain what you mean by the "Empty Cart" text?

    Do you mean the "0 items - 0 NOK" text or the hover text "Start shopping"?

    Thanks!
    Ewout

  3. mottersland
    Member
    Posted 1 year ago #

    "0 items - 0 NOK" , if this could be changed into something else when the cart is empty?

  4. Ewout
    Member
    Plugin Author

    Posted 1 year ago #

    Hi Mottersland,
    This is currently not possible, but I think there shouldn't be too much in the way of adding this. I'll look into it and let you know soon!

    Ewout

  5. bocage
    Member
    Posted 9 months ago #

    Hi Ewout.

    Is this implemented yet?

    Kind regards
    Bocage

  6. Ewout
    Member
    Plugin Author

    Posted 9 months ago #

    Hello Bocage,
    You can do this with a filter in your theme's functions.php:

    add_filter( 'wpmenucart_menu_item_a_content', 'wpmenucart_empty_display_text', 10, 4 );
    function wpmenucart_empty_display_text ( $menu_item_a_content, $menu_item_icon, $cart_contents, $item_data ) {
    	if ($item_data['cart_contents_count'] == 0) {
    		$menu_item_a_content = '<span class="wpmenucart-empty-display">Go to webshop</span>';
    	}
    	return $menu_item_a_content;
    }

    Let me know if you have any other questions!

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

Tags

No tags yet.