Support » Plugin: WooCommerce » Redirect to Cart

  • I only allow 1 product per checkout. I have added the code below. however I want the user redirected to the cart after they add the product. I can not seem to get the code modified to get the user directed to the cart. Can you see where my code is wrong?

    add_filter( 'woocommerce_add_cart_item_data', 'woo_custom_add_to_cart' );
     
    function woo_custom_add_to_cart( $cart_item_data ) {
    global $woocommerce;
    $woocommerce->cart->empty_cart();
    wc_add_notice( 'You can only order 1 item at a time.  Other items have been removed', 'error' );
     
    return $cart_item_data;
    • This topic was modified 1 year, 10 months ago by  surfyourname.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Redirect to Cart’ is closed to new replies.