Recipe: Pickup and delivery options at checkout

Enable the selectors

The web-checkout selectors are gated by the mam_show_wc_delivery_on_web option (no admin toggle in this plugin — set it via WP-CLI/option, or a sibling plugin’s settings):

wp option update mam_show_wc_delivery_on_web 1

With it on, the checkout billing form gains three required fields:

Field Name Notes
Location pickup_location Dropdown when the vendor has multiple locations; hidden field when there is exactly one. Each location shows a Google Maps address link.
Date pickup_date Populated from the location’s active weekdays
Time pickup_time Populated via AJAX after a date is chosen

The labels read “Delivery Location / Date / Time” by default; change the word with:

add_filter( 'mam_wc_delivery_pickup_delivery_type', function () {
    return 'Pickup';
} );

Checkout fails validation with an error notice if date or time is left unselected.


Where the choices land on the order

On checkout completion the selections are written to the order (HPOS-safe):

Order meta Source field Used by
_pickupDeliverOption pickup_location Available-orders board (location title shown to unclaimed drivers)
_selectedTime, delivery_time_range pickup_time Start-order cron window
_selectedDate, delivery_date_formatted pickup_date Start-order cron (“today” match)

When payment completes, the customer gets the wc-delivery-new-order-notification SMS (billing phone) and all users get wc-delivery-new-order, and the order is stamped with order_created.


Where the dates and times come from

  • Product Vendors sites: the vendor is resolved from the first cart item, their pv-location posts (linked by mam-pv-id meta) supply the location list, and the mam_wc_pv_locations_for_vendor filter (provided by mam-woocommerce-product-vendors) supplies each location’s active weekdays and time slots — the data entered in the Location Time Slots meta box (see Recipe: Configure delivery areas).
  • Non-Product-Vendors sites: supply the data yourself via filters:
add_filter( 'mam_wc_delivery_checkout_vendor_name', fn() => 'My Store' );
add_filter( 'mam_wc_delivery_checkout_vendor_id',   fn() => 1 );
add_filter( 'mam_wc_delivery_checkout_locations',   fn() => get_posts( array( 'post_type' => 'pv-location' ) ) );
add_filter( 'mam_wc_delivery_checkout_locations_dow', function ( $location_array ) {
    // Return ['delivery_locations' => [ [ 'id' => ..., 'dow_array' => [...],
    // 'dow_full_array' => [...], '<dow>' => [ time slots ] ] ] ]
    return $location_array;
} );

The date and time dropdowns refresh through two public AJAX endpoints (update_dates_for_location, update_times_for_location) as the shopper changes location/date.


  • Plugin: mam-woocommerce-delivery
  • Recipe: Configure delivery areas
  • Recipe: Transport statuses and customer notifications

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
Contents

    Need Support?

    Can't find the answer you're looking for? Don't worry we're here to help!