Drupal Commerce: Redirect to cart after adding a product

Sometimes, you want the visitor to go directly to the cart, instead of staying in the same page and having a success message telling him that his product has been added to the cart.

In order to go directly to the cart, add (import) this Rule from Admin > Configuration > Workflow > Rules > Import rule, Or http://www.example.com/?q=admin/config/workflow/rules/reaction/import

{ "rules_redirect_to_cart" : {
    "LABEL" : "Redirect to cart",
    "PLUGIN" : "reaction rule",
    "REQUIRES" : [ "rules_conditional", "rules", "commerce_cart" ],
    "ON" : [ "commerce_cart_product_add" ],
    "DO" : [ { "CONDITIONAL" : [  ] }, { "redirect" : { "url" : "cart" } } ]

Very usefull for single product websites, subcriptions based services and deals websites.

1 comment

  1. Why is the action an empty conditional?
    (I was going to simply import your rule, but don’t want to install rules_conditional for this, esp as the condition is empty)

Leave a comment

Your email address will not be published.