Set the token
- Create a Mapbox account at mapbox.com and copy a public access token with the Geocoding and Directions APIs enabled.
- Paste it into Mobile App Manager → WooCommerce Settings → Ride Share → Map Box Token (option
tsl-setting-ride_share_map_box_token).
The token is stored as a plain WordPress option — treat it like any site credential and prefer a token you can rotate.
What Mapbox powers
| Capability | Mapbox API | Used for |
|---|---|---|
| Forward geocoding (address → lat/lon) | Geocoding | Manually entered pickup/destination addresses at booking |
| Reverse geocoding (lat/lon → address) | Geocoding | “Current Location” pickups; the mam_ride_share_get_address_by_lat_lon helper filter |
| Routing distance and duration | Directions (driving) | Driver ranking at booking, trip_distance/trip_duration, per-mile fares |
| ETA during the trip | Directions (driving) | The live eta shown to the rider and the “arriving in 2 minutes” notice |
Successful forward geocodes are cached in the {prefix}saas_delivery_address_db table (shared with MAM WooCommerce Delivery), so repeat addresses don’t re-hit the API. Requests time out after 15 seconds (5 to connect), so a Mapbox outage slows but never hangs a booking or ping.
What breaks without a token
With no (or an invalid) token every Mapbox call returns nothing, and the flow degrades like this:
- Booking by entered address fails: the address can’t be geocoded, the pickup zip can’t be confirmed, and zip matching rejects the trip — riders see “no drivers available” / “not supported” messages even when drivers are on duty.
- Driver ranking fails: the booking loop requires a routing result per driver, so no driver qualifies — again “There are no drivers available at the moment for this trip.” (The home-screen “Order Ride” button uses a straight-line distance check that does not need Mapbox, so the button can appear and the booking still fail.)
- Distance and duration fall back to 0: any ride that does get created (e.g. manager-assigned) records
trip_distance0 — a per-mile fare bills nothing. - ETA falls back to a fixed 10 minutes: the rider’s ETA display is meaningless and the “arriving in 2 minutes” notification can’t trigger accurately.
In short: the duty toggle, the state machine, and notifications keep working, but matching, fares, and ETAs need the token.
Related articles
- Plugin: mam-woocommerce-ride-share
- Recipe: Set up a ride-share service
- Recipe: Configure ride fares
- Hook:
mam_post_id_for_eta
Metadata
| Field | Value |
|---|---|
| Article type | Recipe |
| Plugin slug | mam-woocommerce-ride-share |
| Applies to plugin version | 1.3.1+ |
| Category | Building Your App |
| Audience | App builder |
| Last verified | 2026-06-10 |
