Discussions

make "add to cart" button go straight to checkout?

Hi there,
I'm playing with DC for the first time today - very impressed I must say. It's a big leap forward from Ubercart.

I wonder if anyone can point me in the right direction for this. I would like to modify the "add to cart" button so that it takes the customer straight to the checkout page - and change the button label to "buy now" or some such.

How should I go about this?

Cheers,

Phil

Posted: Jun 2, 2011

Comments

neardark on June 4, 2011

I haven't tested this, but I suspect you might just be able to do this using Rules:

  • Navigate to Admin > Configuration > Workflow > Rules
  • Click Add New Rule and enter a name for your new rule
  • Choose the After adding a product to the cart event
  • Under Actions, choose Add Action
  • Under the System heading, choose Page Redirect
  • Enter the URL to your cart path (cart)
  • Save the Rule
  • Hope this helps,

    John / NEARDARK

    Samirah on October 6, 2011

    I tried the rule as suggested by neardark and it worked, but when I added some conditions to check the products added to cart, it stop working.
    This is the rule:
    { "rules_reindirizza_utente_dopo_aggiunta_abbonamento_al_carrello" : {
    "LABEL" : "Reindirizza l'utente dopo l'aggiunta di un abbonamento al carrello",
    "PLUGIN" : "reaction rule",
    "TAGS" : [ "commerce" ],
    "REQUIRES" : [ "commerce_order", "rules", "commerce_cart" ],
    "ON" : [ "commerce_cart_product_add" ],
    "IF" : [
    { "commerce_order_contains_product" : {
    "commerce_order" : [ "commerce_order" ],
    "product_id" : "7",
    "operator" : "\u003e=",
    "value" : "1"
    }
    },
    { "OR" : [
    { "commerce_order_contains_product" : {
    "commerce_order" : [ "commerce_order" ],
    "product_id" : "8",
    "operator" : "\u003e=",
    "value" : "1"
    }
    },
    { "OR" : [
    { "commerce_order_contains_product" : {
    "commerce_order" : [ "commerce_order" ],
    "product_id" : "9",
    "operator" : "\u003e=",
    "value" : "1"
    }
    }
    ]
    }
    ]
    }
    ],
    "DO" : [ { "redirect" : { "url" : "cart" } } ]
    }
    }

    What am I doing wrong?

    Edit: it seems it's a problem linked to logic operators.