‘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.
Thanks.
Leave an answer