rami_levy_reorder_from_history
Reorder frequent items from your purchase history by scanning recent orders and adding each recurring product to your cart at its median past quantity.
Instructions
Look at the last numOrders (default 10, max 50) real orders, find items that appear in at least minOccurrences (default 3) of them, and add each at its median past quantity. ADDS onto whatever is already in the cart — it does not replace it. Returns cartTotal (local estimate) and serverTotal (Rami Levy's own total — authoritative). ok:false with a transport reason means nothing changed. reason items_rejected means the server refused the listed products; they have been removed from the cart too, so tell the user and pick alternatives. If resetAfterOrder {orderId, createdAt} is present, an order was placed since the last sync, so the items from before it were treated as bought and cleared first; tell the user the cart started fresh after that order.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| numOrders | No | ||
| minOccurrences | No |