Skip to content

DeliveryOptionsModule

Module in @evolve-framework/commercetools

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

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

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

new DeliveryOptionsModule(options: DeliveryOptionsModuleOptions)
OptionTypeDescription
customTypesPick<CustomTypeKeys, "order">

Key of the custom type this project has provisioned for a cart, the same one CartModule is given. It needs a deliverySlot String field, which holds the chosen slot, deliverySplit and requestedDeliveryDate String fields for the delivery preference, and a pickupPoint String field when pickup points are offered.

providerDeliveryOptionsProvider

Where the delivery dates and slots come from: shippingMethodSchedule(schedule) for the project's own shipping methods, 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: a provider without it makes no promises.

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

The carrier and delivery estimate of one shipping method, 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 medusa.