Question

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.

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top