Vote up!
Vote down!

Dynamically prevent products in cart from being purchased

We have products that can only be purchased before certain times, e.g. customers can't purchase on the day of delivery.

This is implemented via a field attached to the line item that stores the dates the customer intends to purchase the product for.

How can we require that the dates are still in the future at checkout review time?

I realise this doesn't fully solve the problem of a customer ordering a product for the past, but does deal with our common case of a user creating a cart, then coming back much later and completing the order.

Asked by: claw
on December 13, 2015

1 Answer

Vote up!
Vote down!

You should be able to do this via Rules, based on the order/checkout status condition and when an order/checkout is viewed as an event. Then validate the date field to the current system date.

Answer by: Travis
Posted: Dec 16, 2015