Actually we are going to sell Items very cheap on our Sale Day for Marketing So we want that one customer can place only one order on that day.

I have already made a module so that customer will have only one product in entire cart but I am not getting how can I limit Number of orders by customer on that day.

1 Answer 1


You can achieve this on a same way as you are checking cart for one product at a time.

You have to call a event checkout_cart_product_add_after OR checkout_cart_product_add_before

In this same method you will get the customer detail from session . You just need to load all order of the current customer and filter with current date. if you get any order data then you can remove that quote and give a message there.

class Fooman_Example_Model_Observer
    public function catalogProductTypePrepare($observer)
        $quote = Mage::getSingleton('checkout/session')->getQuote();
        if (Mage::getSingleton('customer/session')->isLoggedIn()) {
            $customerData = Mage::getSingleton('customer/session')->getCustomer();
            $customerId = $customerData->getId();

            $fromDate = date('Y-m-d 00:00:00');
            $toDate = date('Y-m-d 59:59:59');
            $order = Mage::getModel('sales/order')->getCollection()
                ->addFieldToFilter('customer_id', $customerId)
                ->addAttributeToFilter('created_at', array('from' => $fromDate, 'to' => $toDate));

        if (count($order)) {
            Mage::throwException('You already ordered today.');

The events xml

    <?xml version="1.0"?>
  • I used most voted answer on this page for one item per cart magento.stackexchange.com/questions/9584/… Ashish, Can you describe in brief how to do that?
    – Lalji
    Commented Sep 8, 2016 at 7:26
  • You can use my updated answer, This is not checked code so please check it properly. Commented Sep 8, 2016 at 7:58
  • Ashish, Thanks for your Help, It is working so fine after small edit but It has one issue that if customer is not logged in and then customer adds product to cart without logging in and customer logs in at checkout page and can place order successfully. Do you have any idea about that?
    – Lalji
    Commented Sep 8, 2016 at 11:15
  • Ashish, Can we check before placing order instead of checking before adding to cart that customer has bought before or not?
    – Lalji
    Commented Sep 8, 2016 at 12:04
  • Yes we can, just change the event and make a new function for this event. Check the new event in my updated answer Commented Sep 8, 2016 at 12:21

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.