How the check works
When the app needs to validate a delivery address it calls the wc_delivery_in_delivery_area subaction with the customer’s coordinates (check_lat / check_lon), the store id (store_id), and optionally a zip. The server answers {"allowed":"yes"} or {"allowed":"no"}.
Which check runs is chosen by the wc_delivery_in_delivery_area_type filter (default area):
| Check type | What it compares | Data source |
|---|---|---|
area (default) |
Customer point inside any delivery polygon | delivery_area post meta on the store post (drawn on the app map) |
zip_codes |
Customer zip in an allow-list | mam_wc_delivery_area_zip_codes filter |
product_vendors_service_area |
Distance from vendor location vs. service radius | Product Vendors vendor meta (service_radius, lat, lon) |
See Hooks: delivery-area checks for the PHP snippets to switch type or supply zip codes.
Option A — Map areas (default)
Delivery areas are polygons stored in the delivery_area post meta of a store post and edited from the app:
- Add the WC Delivery Location Map content (
mam_wc_delivery_delivery_locations) to the app as a button/tab. - Assign the add a location Gravity Form (option
wc_delivery_wc_mam_delivery_map_form, set on the form settings screen). With a form assigned, the map screen gets an Add button so stores can be created from the app. New store posts are created asmam-cpt-mainposts under the configurable parent (see Hooks: white-label overrides and the Store Location Parent Post ID setting). - Draw the delivery area on the store’s map in the app. Each polygon is saved as an annotation; deleting an annotation (the
delete_map_annotationsubaction) requires store-manager rights (manage_woocommerce).
The point-in-polygon test answers yes if the customer location falls inside any saved polygon for the store. The store post consulted can be overridden with the mam_wc_delivery_store_id_for_delivery_area filter.
Large store images (over 800px) in the map list are routed through a resizer URL — configurable via the Large Image Resizer URL Prefix setting.
Option B — Zip-code allow-list
Switch the check type and supply the list:
add_filter( 'wc_delivery_in_delivery_area_type', function () {
return 'zip_codes';
} );
add_filter( 'mam_wc_delivery_area_zip_codes', function ( $zips ) {
return array( '94101', '94102', '94103' );
} );
The customer’s zip request value is matched exactly (string comparison) against the list.
Option C — Product Vendors service area
For Product Vendors sites where each vendor declares a service radius:
add_filter( 'wc_delivery_in_delivery_area_type', function () {
return 'product_vendors_service_area';
} );
The check reads the vendor taxonomy meta (taxonomy_{store_id}_metas option): the distance between the customer’s coordinates and the vendor’s lat/lon must be within service_radius (first token, e.g. "25 miles" → 25; a radius of 0 falls back to 50).
Store locations (pv-location)
Separate from the map polygons, the Store Location CPT (pv-location) holds the per-vendor locations used by the checkout selectors:
- Location Details meta box: street, city, state, zip (geocoded to
_lat/_lonon first save), number of trucks, and a driver dropdown per truck. - Location Time Slots meta box: per-weekday active checkbox with start/end times — these drive the date/time dropdowns at checkout (see Recipe: Pickup and delivery options at checkout).
- The
mam-pv-idpost meta links a location to its Product Vendors vendor.
Related articles
- Plugin: mam-woocommerce-delivery
- Recipe: Pickup and delivery options at checkout
- Hooks: delivery-area checks (
wc_delivery_in_delivery_area_type) - Hooks: white-label overrides (
mam_wc_delivery_store_post_parent)
Metadata
| Field | Value |
|---|---|
| Article type | Recipe |
| Plugin slug | mam-woocommerce-delivery |
| Applies to plugin version | 1.4.1+ |
| Category | Building Your App |
| Audience | App builder, store manager, PHP developer |
| Last verified | 2026-06-10 |
