Skip to main content

Stores Delivery Adapter

Pickup delivery from a static list of stores configured on the provider. No external API dependencies.

Included in All Preset

Registered automatically by registerAllPlugins().

If you use the base preset or register plugins individually:

import { pluginRegistry } from '@unchainedshop/core';
import { PickMupPlugin } from '@unchainedshop/plugins/delivery/stores';

pluginRegistry.register(PickMupPlugin);

Setup​

mutation CreateStoresDelivery {
createDeliveryProvider(deliveryProvider: {
type: PICKUP
adapterKey: "shop.unchained.stores"
}) {
_id
}
}

Adapter Details​

PropertyValue
Keyshop.unchained.stores
TypePICKUP
Auto-releasefalse (pickup orders require manual confirmation)
Sourcedelivery/stores

Configuration Options​

Set a stores configuration key on the provider (Admin UI or updateDeliveryProvider) containing a JSON array of locations. Each location should match the DeliveryLocation shape:

[
{
"_id": "store-1",
"name": "Main Store",
"address": {
"addressLine": "Bahnhofstrasse 1",
"postalCode": "8001",
"city": "Zurich",
"countryCode": "CH"
},
"geoPoint": { "latitude": 47.3769, "longitude": 8.5417 }
}
]

pickUpLocations() returns the parsed array; pickUpLocationById(id) matches on _id.

Usage in Checkout​

query GetPickupLocations($providerId: ID!) {
deliveryProvider(deliveryProviderId: $providerId) {
... on DeliveryProviderPickUp {
pickUpLocations {
_id
name
address {
addressLine
city
}
geoPoint {
latitude
longitude
}
}
}
}
}

Select a pickup location for the cart:

mutation SetPickupLocation($deliveryProviderId: ID!, $locationId: ID!) {
updateCartDeliveryPickUp(
deliveryProviderId: $deliveryProviderId
orderPickUpLocationId: $locationId
) {
_id
delivery {
... on OrderDeliveryPickUp {
activePickUpLocation {
_id
name
}
}
}
}
}

Dynamic Store Locations​

For stores managed in a database or external system, register a pickup adapter with a locations callback via the registerPickUpDelivery factory:

import { registerPickUpDelivery } from '@unchainedshop/core';

registerPickUpDelivery({
adapterId: 'dynamic-stores',
autoReleaseAllowed: false,
locations: async () => {
const stores = await storeRepository.findActive();
return stores.map((store) => ({
_id: store._id,
name: store.name,
address: store.address,
geoPoint: store.geoPoint,
}));
},
send: async (configuration, { order }) => {
await notifyStore(order);
return false;
},
});