How the Cart Validation Works in the Frontend
1) Basic Requirements
The product must be configured as a rental item (tab Specifications → Rental).
All relevant plugin settings (e.g. net/gross calculation, calendar, opening hours) must be saved.
Afterwards, clear the cache if necessary.
2) When clicking “Add to cart,” the plugin performs the following checks — in this order:
A. Date Overlap (always active, regardless of parallel rentals)
The plugin checks whether the selected rental period overlaps with any existing reservation.
If yes, and parallel rentals are not allowed (or Max. Parallel = 0/empty),
the item cannot be added to the cart.
The frontend displays an error message (snippet e.g. notAvailable).
B. Parallel Rentals (only if enabled)
If “Check parallel rentals” is enabled for the product, the plugin determines:
the already reserved quantity during the requested period (from the reservation table),
the quantity already in the current cart,
and the currently requested quantity.
These values are added up to form the total planned quantity.
If the total planned quantity exceeds the product’s setting for “Max. parallel rentals,”
the addition to the cart is rejected.
The error message shows the allowed maximum (snippet e.g. maxParallelDays).
C. Quantity Limit per Add-to-Cart
If the customer increases the quantity (e.g. “30 items”), this quantity is also included in the total planned quantity.
Even if there are no items yet in the cart, the system blocks the addition if
requested quantity + existing reservations > Max. Parallel.
3) Examples
Parallel rentals disabled
An existing reservation: Oct 22 – Oct 28
Requested period: Oct 21 – Oct 29 → Overlaps → Rejected (regardless of quantity).
Parallel rentals = 2
One reservation already exists.
Customer adds quantity 2 → total = 1 + 2 = 3 > 2 → Rejected.
Customer adds quantity 1 → total = 1 + 1 = 2 → Allowed.
4) Display and Messages
All error and info texts are managed via snippets (e.g. notAvailable, maxParallelDays, minDays, maxDays).
This means all messages are fully translatable.
5) Technical Overview (no code)
The logic runs before the actual add-to-cart process.
It considers both:
existing reservations in the requested period, and
items already in the current cart.
Only if all checks pass will the rental item be added successfully.
💡 Tester Tip:
Ensure the product is correctly configured as a rental item (prices, min/max days, parallel settings, etc.)
and clear the shop cache before testing — this ensures all configuration and snippet changes are applied properly.
Last updated