1

Ist it possible to add validation rules for Carts/Orders? I need to check whether there is at least one list item added to the cart before payment is initiated.

Unlike addresses (Address::EVENT_REGISTER_ADDRESS_VALIDATION_RULES) there seems not to be an event for manipulating rules.

I’d prefer a server-side solution.

1 Answer 1

1

There is a setting for this specific instance allowEmptyCartOnCheckout.

Creating a commerce.php file in the config directory with the following code will prevent customers from checkout out with an empty cart.

<?php

return [
  'allowEmptyCartOnCheckout' => false
];

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.