I have only one product and I have to sell directly and not via product page or home page. When visiting the site URL it should directly add a product into the cart and redirect to checkout page.

1 Answer 1


You can add an observer to, for example, controller_action_predispatch and check for products in the cart. However make sure the checkout URL's ship this.

The observer would look something like

public function checkProductAdded($o) 
    $cart = Mage::getModel('checkout/cart')->getQuote();
    if (count($cart->getAllItems())) {
        return $this;

    $product = Mage::getModel('catalog/product')->load([id of product]);
    $params = array('qty' => 1);

    $cart->addProduct($product, $params);




Didn't test it but with a little tweaking it should work

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.