php - Woocommerce Add To Cart redirect to Checkout not working for product with variants -
i'm trying redirect people click on add cart button checkout page directly. add cart button adding product cart not redirecting @ all.
the code use working product no variations.
i'm using latest version of woocommerce 3.0.1.
//redirect checkout add_filter ('add_to_cart_redirect', 'redirect_to_checkout'); function redirect_to_checkout() { return wc()->cart->get_checkout_url(); }
try this:
function add_to_cart_checkout_redirect() { wp_safe_redirect( get_permalink( get_option( 'woocommerce_checkout_page_id' ) ) ); die(); } add_action( 'woocommerce_add_to_cart', 'add_to_cart_checkout_redirect', 11 );
Comments
Post a Comment