I want to apply restrictions for customers. A customer can have maximum 99 orders per month and the total monthly purchase limit should be 500$.Any help.

  • 1
    You really should try to explain more about what you have tried up to this point. – philwinkle Mar 11 '14 at 6:31

Short question, short answer.

First: If you allow guest orders, this doesn't make sense, just for the case.

You could check with an observer against the orders who one customer made, but I think this is pretty slow to sum up all the orders by one customer all the time.

  • So I would add two new attributes to the customer (one to count the order, one to sum the grand total), implement an observer for adding a new order and update the two attributes.
  • Implement a second observer to check, e.g. in controller_action_predispatch if the customer already reach the limit and add a message, so he knows.

  • Implement a third observer e.g. in controller_action_predispatch_checkout_onepage_index and redirect the customer to wherever to don't allow him to checkout, maybe add a second error message.

  • Implement a cron to reset the attributes every first of the month

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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