‘woocommerce_add_to_cart_redirect’ hook stopped working


I am trying to redirect directly directly to checkout when user hits “add to cart” and my code worked before but somewhere along the way it stopped working and I cannot pinpoint why.

add_filter( 'woocommerce_add_to_cart_redirect', 'rd_redirect_checkout_add_cart' );

function rd_redirect_checkout_add_cart() {
   return wc_get_checkout_url();

So now when i hit add to cart, the page refreshes, the item gets added to cart and that is about it. If i hit it again, it again refreshes and adds to cart. No redirection happens.
this is the url site.com/?add-to-cart=499

I have tried disabling all plugins, removed the redirect code, and used redirect plugin, tried everything and dont know what else to do.

Any ideas would be helpful.

, httpmax 3 years 2020-04-02T00:50:50-05:00 0 Answers 92 views 0

Leave an answer