How to redirecting add to cart form in drupal commerce programatically? I just wants to redirect the add to cart form to a different page. After click on add to cart button i do not wants to go cart page. i just want to go thank you page.

for that i am altering the form 

 if($form_id == 'commerce_cart_add_to_cart_form_1'){
            $form['submit']['#value'] = t("Submit Event");
            $form['#submit'][]= 'post_event_save';  
    }


by using the above code i am able to redirect to post event save page but it will not stop in that page again redirect cart page after executing this post_event_save function.

what i have tried post_event_save function

drupal_goto();
$form_state['redirect'] = false;
$form_state['rebuild'] = TRUE;


by printing the form_state variable

[#validate] =&gt; Array
                (
                    [0] =&gt; commerce_cart_add_to_cart_form_validate
                    [1] =&gt; tasteusa_commerce_add_to_cart_form_validate
                )

            [#submit] =&gt; Array
                (
                    [0] =&gt; commerce_cart_add_to_cart_form_submit
                    [1] =&gt; post_event_save
                )

            [#after_build] =&gt; Array
                (
                    [0] =&gt; commerce_cart_add_to_cart_form_after_build
                    [1] =&gt; context_form_alter_node_after_build
                    [2] =&gt; test_commerce_after_build
                )
Check if you have any redirect rules enabled under admin/config/workflow/rules, which is force redirecting you to cart page.

As a solution you can have your custom redirection rule and disable the existing redirection rule, an example redirection rule which redirects to node/2 path after adding product to cart.

{ "rules_add_product_to_cart_redirect" : {
    "LABEL" : "Add Product to Cart Redirect",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "TAGS" : [ "add-to-cart-redirect" ],
    "REQUIRES" : [ "rules", "commerce_cart" ],
    "ON" : { "commerce_cart_product_add" : [] },
    "DO" : [ { "redirect" : { "url" : "node\/2" } } ]
  }
}


In case you import the above remember to change the redirect path from node/2 to your thank-you page.