Kashif Waheed
Kashif Waheed

Reputation: 31

woocommerce redirection to any other page after add to cart

i am working on woocommerce plugin and i want to redirect after click to another page titled "fill out the form" and the ID of the page is "721". i know about the option for redirect to checkout page but i what i want to do is when user click add to cart button then he should be redirected to another page that have a form and when he fill out the form then he would be redirected to the check out page.

below is the code that i found but it redirects to the checkout page.

add_filter('add_to_cart_redirect', 'custom_add_to_cart_redirect');

function custom_add_to_cart_redirect() {
 return get_permalink(get_option('woocommerce_checkout_page_id'));
 }

Upvotes: 0

Views: 382

Answers (1)

raju
raju

Reputation: 321

function custom_add_to_cart_redirect() { 
    return 'http://www.yourdomain.com/your-page/'; 
}
add_filter( 'woocommerce_add_to_cart_redirect', 'custom_add_to_cart_redirect' );

Upvotes: 1

Related Questions