Title: Redirect
Last modified: August 21, 2016

---

# Redirect

 *  [Edvinas L](https://wordpress.org/support/users/edvinas-l/)
 * (@edvinas-l)
 * [12 years ago](https://wordpress.org/support/topic/redirect-57/)
 * Hello,
 * How to make, that if cart is empty, people who click on it will be redirect to
   somewhere else, but not into a shop?
 * Thanks.
 * [https://wordpress.org/plugins/woocommerce-menu-bar-cart/](https://wordpress.org/plugins/woocommerce-menu-bar-cart/)

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Contributor [Ewout](https://wordpress.org/support/users/pomegranate/)
 * (@pomegranate)
 * [12 years ago](https://wordpress.org/support/topic/redirect-57/#post-5122895)
 * Check out the documentation here: [https://wpovernight.com/faqs/change-empty-cart-redirection/](https://wpovernight.com/faqs/change-empty-cart-redirection/)
 *     ```
       /**
       * 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;
       }
       ```
   
 *  Thread Starter [Edvinas L](https://wordpress.org/support/users/edvinas-l/)
 * (@edvinas-l)
 * [12 years ago](https://wordpress.org/support/topic/redirect-57/#post-5122907)
 * Doesn’t work.
 * I tried to put this code inside <php> tags and without it. If I try to remove
   products from cart, I gain an error.
 * For example i take functions.php file from: wp-content/themes/theme-name/function.
   php
 *  Plugin Contributor [Ewout](https://wordpress.org/support/users/pomegranate/)
 * (@pomegranate)
 * [12 years ago](https://wordpress.org/support/topic/redirect-57/#post-5122909)
 * Hello Edvinas,
    Two things might be at play here:
    - When you applied the code, perhaps you thought it didn’t work, but the old
      url was still cached? After you have changed the code, you need to close &
      reopen de browser tab (refresh won’t help!).
    - You write “I tried to put this code inside `<php>` tags”. Usually that’s not
      necessary in functions.php. Even so, php opening and closing tags are `<?php`
      and `?>`. Perhaps you put it after the last `?>` in your functions.php? Most
      of the times functions.php doesn’t have the closing tag, this is better for
      many reasons, but if it does have the closing tag, either remove it or put
      the code before the closing tag (and make sure that there is no whitespace
      or code after the closing tag).
 * Let me know if this helps you solve the issue, otherwise, it helps if you paste
   the last part of your functions.php here (i.e. the lines before where you pasted
   the code).

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Redirect’ is closed to new replies.

 * ![](https://ps.w.org/woocommerce-menu-bar-cart/assets/icon-256x256.png?rev=2190481)
 * [Menu Cart for WooCommerce](https://wordpress.org/plugins/woocommerce-menu-bar-cart/)
 * [Support Threads](https://wordpress.org/support/plugin/woocommerce-menu-bar-cart/)
 * [Active Topics](https://wordpress.org/support/plugin/woocommerce-menu-bar-cart/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woocommerce-menu-bar-cart/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woocommerce-menu-bar-cart/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [Ewout](https://wordpress.org/support/users/pomegranate/)
 * Last activity: [12 years ago](https://wordpress.org/support/topic/redirect-57/#post-5122909)
 * Status: not resolved