Signature
$data = apply_filters( 'mam_wc_pv_locations_for_vendor', array $data, int $vendor_id );
| Parameter | Type | Description |
|---|---|---|
$data |
array |
Seed array (pass array(); the registered handler rebuilds it from the vendor id) |
$vendor_id |
int |
The vendor term id whose locations you want |
Returns the location data array the app screens use. Notable keys set by the handler:
delivery_locations— one entry per published, openpv-locationpost for the vendor:id,title,address,type(pickup), open-hours fields, per-day active flags,dow_arraydate windows,daysAllowed,closed_days,min_prep_time, andtax_rate/tax_rate_2(+ titles) when set on the location.dateDowFilter— allowed days-of-week for date pickers (when inside geofilters).inside_geofilters(yes/no),sort_distance,lat/lon— geofilter results relative to the requesting device’slat/lonrequest params.
When it runs
This plugin registers the canonical handler at priority 10 (in the bootstrap, gated on WooCommerce Product Vendors being active). It runs whenever a consumer applies the filter — there is no caching, so each call queries the vendor’s pv-location posts (and geocodes any location that is missing coordinates, using the tsl-google-api-key option).
It exists as the REPO_BOUNDARIES-compliant entry point for sibling plugins: mam-woocommerce-delivery‘s pickup/delivery selector calls it (guarded by has_filter) instead of instantiating this plugin’s phone-data class.
Example — read a vendor’s locations from another plugin
if ( class_exists( 'WC_Product_Vendors_Utils' ) && has_filter( 'mam_wc_pv_locations_for_vendor' ) ) {
$data = apply_filters( 'mam_wc_pv_locations_for_vendor', array(), $vendor_id );
foreach ( (array) ( $data['delivery_locations'] ?? array() ) as $location ) {
// $location['id'], $location['title'], $location['address'], …
}
}
Notes
- Locations with no configured open days/hours are skipped — an empty
delivery_locationsdoes not necessarily mean the vendor has no locations, only none that are orderable. - Because the handler reads
$_REQUEST['lat']/['lon']/['radius']for geofiltering, results can differ per request context; call it during an app request for device-relative data. - To post-process the result (e.g. add a synthetic location), add your own filter at priority > 10 — the handler replaces the array wholesale, so earlier filters are overwritten.
Related articles
- Recipe: Storefront and vendor screens
- Plugin: mam-woocommerce-product-vendors
Metadata
| Field | Value |
|---|---|
| Article type | Hook Reference |
| Plugin slug | mam-woocommerce-product-vendors |
| Applies to plugin version | 26.19.1+ |
| Category | Extending MAM Suite |
| Hook type | filter |
| Audience | PHP developer / integrator |
| Last verified | 2026-06-10 |
