=== Sofrah Order Board ===
Contributors: ahmedmahgoup94
Tags: restaurant, pickup, takeaway, orders, woocommerce
Requires at least: 7.0
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 0.3.7
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Pickup orders wait for the restaurant to accept them. Staff work from one order board; diners follow their order on a status page.

== Description ==

With WooCommerce on its own, a pickup order looks agreed the moment it is placed: the diner gets a "Thank you for your order" email before anyone in the kitchen has seen it. Sofrah Order Board adds the missing step.

* **The restaurant accepts or rejects each order.** A new pay-at-pickup order waits on the order board. Staff accept it with a pickup time, or reject it with a reason the diner sees.
* **One order board.** Orders waiting for you come first, then those being prepared, then those ready to collect. It refreshes by itself, shows a clear alert while an order is waiting, and can play a sound.
* **The diner always knows where the order stands.** Emails at each step (received but not accepted yet, accepted with a pickup time, ready, not accepted, cancelled) and a private status page that updates by itself. Until the restaurant accepts, the diner can cancel from that page.
* **Honest confirmation.** After checkout the diner reads "Order sent to the restaurant. It is not accepted yet."
* **Payment at pickup is recorded separately.** Mark an order paid when the money is taken. Marking it collected never marks it paid, and the other way round.
* **One order per checkout.** A slow connection, a double tap or two open tabs do not create two orders (block checkout).
* **Changes only through the board.** While an order is open, WooCommerce's own order screen, bulk actions, its REST API and mobile app, refunds and trash are refused for it, with a message saying why, and each attempt is written to the order's history.
* **Opening hours and pause.** Set your hours (including closing after midnight), closure dates and when online orders stop. Pickup orders are refused outside them, and staff can pause ordering from the board in one tap when the kitchen is overwhelmed.
* **A working site in one click.** Import the restaurant or cafe demo: sample menu, venue, hours, Pay at pickup and the Home, About and Contact pages. Your own dishes and pages are never touched.
* **Checkout asks only for name, email and phone** by default, because the diner collects the order.
* **For themes:** shortcodes for the menu ([sofrah_menu]), the live ordering status ([sofrah_ordering_status]), opening hours ([sofrah_hours]) and venue details ([sofrah_venue field="address|street|phone"]). The free Sofrah theme is built on them.
* **No order note by default.** A free-text note such as an allergy request can be missed by a busy kitchen, so it is removed from checkout and not stored for pickup orders. You can switch this off.

= What it does not do =

* **Alerts only while the board is open.** Keep the order board open in a browser on a device in the kitchen during ordering hours. There are no push notifications, SMS or WhatsApp alerts.
* **No automatic expiry yet.** An order nobody answers stays waiting. Check the board.
* **WooCommerce's sales reports count completed orders as sales.** They do not show what was actually paid at pickup; the order board does.
* **A direct edit of the database cannot be blocked.** If it happens, the order board flags the order.
* It does not take payments, print tickets or handle delivery.

= Privacy =

The plugin sends nothing to its author or to anyone else: no tracking, no usage reports, no remote requests. Orders, names, phone numbers and emails stay in your own WordPress database, as with any WooCommerce order. Emails go through your site's own mail service. WordPress itself tells wordpress.org which plugins are installed when it checks for updates; that is WordPress's behaviour, not this plugin's.

== Installation ==

1. Install and activate WooCommerce.
2. Install and activate Sofrah Order Board. A page called "Order status" is created for diners.
3. In WooCommerce > Settings > Payments, turn on "Cash on delivery", rename it "Pay at pickup", and change its description and instructions to something like "Pay when you collect your order."
4. In WooCommerce > Order board settings, check that "Pay at pickup" is ticked and set your usual pickup time.
5. Open WooCommerce > Order board on the device you will use during service, press "Turn on sound" if you want it, and place a test order.

Use an authenticated mail service for order emails: many hosts limit email sent by plain PHP mail.

== Frequently Asked Questions ==

= Why can I not change the order's status in WooCommerce? =

So that an order cannot be marked completed or cancelled without the diner being told the right thing, and without a reason being recorded. Use the order board. Orders paid by other methods are not affected.

= Does it work with the classic checkout? =

Orders placed through the classic checkout are handled on the board in the same way. The protection against duplicate orders covers the block checkout only.

= Who can cancel an accepted order? =

Users who can manage WooCommerce (administrators and shop managers). Other staff who can edit orders can accept, reject and move orders on.

= What happens outside opening hours? =

The menu stays visible with its buttons switched off, the cart and checkout show when ordering opens again, and the site refuses pickup orders sent any other way. Until you save your hours, orders are never refused.

= Does the diner need an account? =

No. The status page is opened from the link in the order email and on the confirmation page.

== Changelog ==

= 0.3.7 =
* Easier to use on a kitchen tablet: the order card buttons are at least 44 pixels high and the History toggle is a larger target.

= 0.3.6 =
* Deleting the plugin now also removes the venue details, opening hours and its short-lived order counters. Orders and the Order status page are still kept.

= 0.3.5 =
* If order notes are switched on, the diner's note is highlighted on the order card on the board, so the kitchen sees it without opening the order.

= 0.3.4 =
* The author's WordPress.org username in the readme. No change to the code.

= 0.3.3 =

* My account shows the restaurant's words for an order ("Waiting for the restaurant", "Collected") instead of WooCommerce's ("On hold", "Completed"), and links to the order's status page.

* A menu section's page has links to the full menu and the other sections.



= 0.3.2 =
Compatibility release; no change to how the plugin works.
* Runs on PHP 7.4 and later (was 8.1). The full test suite passes on PHP 7.4 and on PHP 8.3.
* Tested with WordPress 7.0 and 7.1 and WooCommerce 10.9 to 11.2; the minimums are now WordPress 7.0 and WooCommerce 10.9.
* Tested on its own with a default WordPress theme (Twenty Twenty-Five): it does not need the Sofrah theme.

= 0.3.1 =
Security release, from a penetration test of 31 Oct 2026.
* Closed or paused ordering is now enforced inside WooCommerce's checkout, whichever way the checkout address is written. Before, an order could be sent while ordering was closed.
* WooCommerce's REST API: a request from someone who may not edit orders now gets WooCommerce's own refusal, and nothing is written to the order. Before, it could learn which order numbers exist and add to an order's history.
* New limits against fake orders, in Order board settings: pickup orders an hour from one internet connection (default 10) and open orders for one phone number (default 3). Staff are never limited; 0 turns a limit off.
* The demo import, which changes the site's title, front page and look, is offered to administrators only.
* Placing the same order twice is recognized from WooCommerce's signed session, never from an unchecked cookie value.
* The order status page asks browsers not to pass its address, which holds the order key, to other sites.

= 0.3.0 =
* The menu shows a dish's photograph when it has one.
* Demo import: a theme can give the sample dishes photographs (filter sofrah_board_demo_image); importing again removes only the demo's own photographs.

= 0.2.0 =
* Opening hours, closure dates, last-order time and pause ordering, enforced by the server.
* Setup checklist, demo import (restaurant and cafe), short pickup checkout.
* Display shortcodes for themes; styled diner status page.
* Function, option and data prefix changed to sofrah_board_.

= 0.1.0 =
* First release: order board, accept or reject with a reason, pickup time, preparing, ready, collected and not collected, payment at pickup, diner emails and status page, duplicate-order protection, status guard.
