Restricted Postcode Manager V1.1 - Checkout Protection
30/10/2026

UPGRADE FROM V1
1. Back up includes/hooks/shop/siteWide/restrict_postcode_verify.php.
2. Upload catalog/includes/hooks/shop/siteWide/restrict_postcode_verify.php
   to the matching location beneath your shop root, replacing the old file.
   Do not upload the enclosing catalog folder itself.
3. Keep your existing restricted_postcodes table and postcode entries.
   No SQL or admin changes are required for this upgrade.

NEW INSTALLATION
Run SQL.txt using phpMyAdmin, then upload the contents of catalog to your
shop root and the contents of admin to your actual admin directory
(for example November). Add prefixes under Customers > Restricted Postcodes.

WHAT CHANGED
V1 checked account registration only. V1.1 also checks the selected DELIVERY
postcode at checkout, including existing accounts and guests using Phoenix
One Page Checkout V1.0.2. It blocks restricted delivery addresses on the
checkout, confirmation and processing pages, OPC validation/handoff, OPC
PayPal create/capture endpoints, and Stripe Hosted Checkout creation.
The existing account-registration restriction is retained.
Prefix matching ignores case and whitespace. Enter BT, not BT* or BT%.
BT matches BT1 1AA, BT12 3AB, etc. Entries are literal prefixes.

A blocked browser request displays a delivery-area message and links to
change the delivery address, return to the basket or contact the shop.
OPC address-editing/saving requests remain available so the customer can
correct their delivery address. Submitting payment is checked again.
JSON payment endpoints receive an error response instead of an HTML page.
Payment webhooks/notifications and checkout-success pages are not blocked.
No core files, OPC files or payment-module files are changed.

TEST BEFORE USING LIVE
Use a test site and test payment mode.
1. As a guest, enter a BT delivery postcode in OPC. After saving the guest
   details, a restriction message should appear before payment selection.
2. Use Change delivery address and replace BT with an unrestricted postcode.
   Checkout should then work normally.
3. Test an existing customer whose delivery postcode starts BT.
4. Test an unrestricted billing address with a BT DELIVERY address: blocked.
5. Test a BT billing address with an unrestricted DELIVERY address using an
   existing account: checkout is allowed; delivery determines the restriction.
6. Repeat using standard checkout if your shop offers it.
7. Test account registration with BT: the original restriction remains.
8. Verify PayPal/Stripe test transactions for unrestricted addresses complete.

SCOPE
This protects storefront checkout. It does not prevent orders entered in
admin/AOM, undo existing orders, or refund payments already made. It checks
postcodes without a country filter, preserving V1's prefix-list behaviour.
Other custom checkout/payment entry points require their own compatibility
review. Payment modules which obtain a different address from a wallet after
leaving the shop require separate testing.

VALIDATION
See Validation.txt for the checks run for this package. Live-shop checkout
and payment-provider testing must be completed on your installation.

Released under the GNU General Public License.
