Skip to content

setPickupPoint(shipping: BasketShipping, point: PickupPoint) void

The setPickupPoint method that allows to set the pickup point for the basket shipping.

Input parameters

shipping

shipping is a mandatory parameter of the BasketShipping type that represents the shipping we want to set the pickup point for.

point

point is a mandatory parameter of the PickupPoint type which represents details of a pickup point to set.

Returned value

A returned value has a type of void as this method returns nothing.

Event Bus events

This API method dispatches the following events with the Event Bus:

Example

In this example we make a basketShippingsApi call to set the pickup point for the basket shipping.

useStorefront(async ({ eventBus, getApi }) => {
    eventBus.on('basket.initialized', async () => {
        const basketProductsApi = await getApi('basketProductsApi');

        const currentBasketShipping = basketShippingsApi.getSelectedShipping();

        const examplePickupPoint = {
            code: 'PP001',
            isCollectOnDeliveryAvailable: true,
            supplier: 'FastShip',
            name: 'Central Pickup Point',
            description: 'Pickup point near the central park.',
            street: 'Park Street',
            houseNumber: '12A',
            city: 'Berlin',
            postalCode: '10115',
            province: null,
            countryCode: 'DE',
            latitude: '52.5200',
            longitude: '13.4050',
            openingHours: '09:00-18:00'
        };

        basketShippingsApi.setPickupPoint(currentBasketShipping, examplePickupPoint);
    });
});

Basket Address API methods reference

Models reference