Please note: This forum is now closed. All the support related enquiries should be reported on wordpress support forum for jigoshop plugin – thanks, Jigoshop Team

add_to_cart_redirect filter

James Kemp

28 Mar, 2013 09:45 PM

I’m building a plugin that requires me to use the ‘add_to_cart_redirect’ filter. However, as it stands this filter doesn’t currently work. From what I can see in the file jigoshop_actions.php, you are using:

if ( apply_filters('add_to_cart_redirect', $url) ) { wp_safe_redirect($url, 301); exit; }

But should it actually be:

if ( apply_filters('add_to_cart_redirect', $url) ) { wp_safe_redirect(apply_filters('add_to_cart_redirect', $url), 301); exit; }

Otherwise the $url variable would still be equal to false in the redirect statement. Let me know if I’m doing something wrong!

  1. Support Staff 2 Posted by Jeff on 29 Mar, 2013 03:18 AM

    Yeah, it seems another did an ‘add to cart’ rewrite back in September … and this was put in then. Quite right … it’s quite wrong.

    We could do it your way, but I’m inclined to put it back to what it was:

             $url = apply_filters( 'add_to_cart_redirect', $url );
                if ( $url ) {
                    wp_safe_redirect( $url, 301 ); exit;

    Don’t ask why it was changed … cause I dunno. :-p

    I’ll get this in for the next release. Thanks for the heads up.

  2. Support Staff 3 Posted by Jeff on 29 Mar, 2013 03:27 AM

    And for future reference James, for things like this you might be better served to file a Ticket on our GitHub repository:

    It’s only because someone alerted me to this that I’ve seen it. I will see it though if you post bug reports on our repository.

  3. 4 Posted by James Kemp on 29 Mar, 2013 09:45 AM

    Hi Jeff,

    Yes, that would be a better way of doing it!

    I had considered adding a ticket on Github, but I don’t really use it and wouldn’t know what I was doing. Thanks for taking a look, glad I’m not going crazy.

Comments are closed, but you can start a new discussion.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac