• Resolved giuliastully

    (@giuliastully)


    Hi, is it possible to redirect a link of the add to cart button depending on the product quantity?
    The button works in ajax, which hook should I use?
    I tried to use this code on the theme function, but it doesn’t work:

    
    function check_quantity() {
        $adult_number=$_POST['adult_number'];
        $child_number=$_POST['child_number'];
        $infant_number=$_POST['infant_number'];
        $total = $adult_number + $child_number + $infant_number;
        if ($total > 4){
            wp_redirect( get_home_url().'/viaggi-gruppo/');
            exit;
        }
    }
    add_filter('woocommerce_add_to_cart', 'check_quantity');
    

    How can I do?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Joash

    (@joashrajin)

    Hi there @giuliastully ??

    It is possible with some customization, however, for assistance for this kind of changes I recommend that you use a service on our Customizations Page.

    I hope that this helps ??

    MayKato

    (@maykato)

    Hi @giuliastully

    We’ve not heard back from you in a while, so I’m marking this thread as resolved. If you have further questions, please feel free to open a new topic.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Redirect add to cart’ is closed to new replies.