Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor Ewout

    (@pomegranate)

    Check out the documentation here: 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

    (@edvinas-l)

    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

    (@pomegranate)

    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.