Skip to content

DeliveryOptionsModule

Module in @evolve-framework/medusa

Delivery dates, time slots and pickup points on Medusa: listing them on the cart and choosing one, which sets the shipping option that charges for it, and reading the choice back on the order.

import { DeliveryOptionsModule } from "@evolve-framework/medusa/modules";

Serves the Delivery options part of the GraphQL API: cartSetDeliveryPreference, cartSetDeliverySlot, cartSetPickupPoint.

new DeliveryOptionsModule(options: DeliveryOptionsModuleOptions)
OptionTypeDescription
providerDeliveryOptionsProvider

Where the delivery dates and slots come from: shippingMethodSchedule(schedule) for the shop's own shipping options, keyed by their type code, or a carrier's API behind the same type.

pickupPoints?PickupPointProvider

Where pickup points come from: pickupPointList(points), or a carrier's location API behind the same type. Without it the cart offers none.

DeliveryOptionsProvider4The fields of provider.
FieldTypeDescription
deliveryDates(request: DeliveryRequest, range: { from?: string | undefined; days: number; }) => Promise<DeliveryDate[]>

Every date from from (today when absent) for days days, slots included.

findSlot(request: DeliveryRequest, slotId: string) => Promise<DeliverySlotChoice | undefined>

The slot a client chose, checked again against the cart; undefined when unknown.

deliveryPromise?((request: DeliveryPromiseRequest) => Promise<DeliveryPromise>)

The earliest delivery of one variant to one place, for a product page. Optional: Medusa prices shipping options only for a cart, so the schedule makes no promises, and a provider without it leaves the field null.

shippingMethodDelivery?((request: ShippingMethodDeliveryRequest) => Promise<ShippingMethodDelivery>)

The carrier and delivery estimate of one shipping option, for the delivery step. Optional: a provider without it leaves both null.

PickupPointProvider2The fields of pickupPoints.
FieldTypeDescription
pickupPoints(request: DeliveryRequest, query: PickupPointQuery) => Promise<PickupPoint[]>

Points matching the query, nearest first when a position was given.

findPickupPoint(request: DeliveryRequest, pickupPointId: string) => Promise<PickupPointChoice | undefined>

The point a client chose, checked again against the cart; undefined when unknown.

Extends AbstractModule<unknown>.

The same module on commercetools.