Appearance
Why Location Overrides?
Square orders include a location_id (the store or location that received the order). You can map each Square location to a different LGL fund/campaign so that:
- Location A (e.g. online store) → Unrestricted Fund
- Location B (e.g. event pop-up) → Event Fund
If you don't set an override, the Square type default (configured in Mappings) is used for all Square orders.
Where to Configure
Dashboard → Mappings (or the Square location overrides section). The UI lists Square locations (from the Square API) and lets you choose an LGL fund (and optionally campaign) per location.
API: GET /api/square/location-overrides, PUT /api/square/location-overrides (admin/super_admin). The dashboard calls these to list and save overrides.
How the Worker Uses Overrides
- Order webhook or polling delivers an order with
order.location_id. - Worker calls
getSquareMappingForLocation(db, order.location_id)(seelib/campaign-mapping.ts). - If a row exists in
square_location_overridesfor that location, use its fund_id (and optional campaign_id). - Otherwise use the Square type default from campaign mapping.
Data Stored
Overrides are stored in D1 table square_location_overrides (migration 013): location_id, fund_id, and optionally other LGL reference fields. Type default is in campaign_type_defaults (e.g. type "square").
Adding or Changing an Override
- In Dashboard → Mappings, open the Square / location overrides section.
- Select a Square location from the list (locations are loaded from Square API).
- Select the LGL fund (and campaign if needed) from the dropdowns.
- Save. New syncs for that location will use the new mapping.

