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:
- FlashMessengerApi.addFlashMessages - when handling messages that come from a server
- basket.basketUpdated - when updating a basket after a successful change of a country
- basket.unexpectedError - when handling unexpected errors
Example¶
In this example we make a basketShippingsApi
call to set the pickup point for the basket shipping.
useStorefront(async (storefront) => {
let basketShippingsApi = storefront.getApiSync('basketShippingsApi');
if (!basketShippingsApi) {
const featureSystemApi = this.getApiSync(FEATURE_SYSTEM_API_NAME);
await featureSystemApi.registerDynamic('basket');
basketShippingsApi = storefront.getApiSync('basketShippingsApi');
}
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¶
- get
- select
- setShipping
- getSelectedShipping
- selectSelectedShipping
- getAvailableShippingCountries
- selectAvailableShippingCountries
- getSelectedShippingCountry
- selectSelectedShippingCountry
- setCountry
- getPaymentCostForActiveShippingByPaymentId
- selectPaymentCostForActiveShippingByPaymentId
- isEveryAvailablePaymentFree
- selectIsEveryAvailablePaymentFree
- getSectionValidation
- selectSectionValidation
- addMap
- showPickupPointMap
- shouldDisplayRemainingBasketValueForFreeShippingMessage
- addShippingInfo
- getShippingInfo