WP Menu Cart Pro #
In WP Menu Cart Pro you can change the texts and links directly in the settings:
Free version #
To change the URL that WP Menu Cart links to, you have to add a filter in your themes functions.php
.
If you don’t know how to use filters read this article. As always, be sure to clear your cache before contacting support with questions.
URL for empty cart #
By default, the URL is typically set to your home page or shop page, depending on the E-Commerce system you’re using. Just change $empty_url
to equal the page of your site.
/** * Set page url when cart is empty */ add_filter('wpmenucart_emptyurl', 'add_wpmenucart_emptyurl', 1, 1); function add_wpmenucart_emptyurl ($empty_url) { $empty_url = 'http://yoursite.com/empty'; return $empty_url; }
URL for cart with items #
By default, the URL is typically set to your cart page. In this example, we’re redirecting it to a checkout (change the URL to your preference).
/** * Set page url when cart has items */ add_filter('wpmenucart_fullurl', 'add_wpmenucart_fullurl', 1, 1); function add_wpmenucart_fullurl ($full_url) { $full_url = 'http://yoursite.com/checkout'; return $full_url; }
Full example: redirect empty cart to cart page #
The default behavior of Menu Cart is to redirect to the shop page when the cart is empty. This code changes that to the (empty) cart page and also changes the hover text/title of the menu item accordingly:
/** * Link empty menu cart to WooCommerce Cart page */ add_filter( 'wpmenucart_emptyurl', 'wpmenucart_emptyurl' ); add_filter( 'wpmenucart_emptytitle', 'wpmenucart_emptytitle' ); function wpmenucart_emptyurl ( $empty_url ) { return wc_get_cart_url(); } function wpmenucart_emptytitle ( $title ) { return __( 'View your shopping cart', 'wpmenucart' ); }