addMap(shipping: BasketShipping, mapStrategy: PickupPointMapStrategy): void¶
The addMap
method allows to add a map for the shipping option using a specified map strategy.
Input parameters¶
shipping¶
shipping
is a mandatory parameter of the BasketShipping type that represents the shipping we want to add a map for.
mapStrategy¶
mapStrategy
is a mandatory parameter of the PickupPointMapStrategy type which represents a strategy of showing a map.
Returned value¶
A returned value has a type of void
as this method returns nothing.
Example¶
In this example we make a basketShippingsApi
call to add a map for the selected shipping option.
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');
}
class ExampleDeliveryPointMap {
public async showMap(choosePickupPointCallback) {
choosePickupPointCallback();
// here goes code for map handling
}
}
class ExamplePickupPointMapStrategy {
public execute() {
return ExampleDeliveryPointMap;
}
}
const selectedShipping = basketShippingsApi.getSelectedShipping()
const basketShippingOptions = basketShippingsApi.addMap(selectedShipping, ExamplePickupPointMapStrategy);
});
Basket Address API methods reference¶
- get
- select
- setShipping
- setPickupPoint
- getSelectedShipping
- selectSelectedShipping
- getAvailableShippingCountries
- selectAvailableShippingCountries
- getSelectedShippingCountry
- selectSelectedShippingCountry
- setCountry
- getPaymentCostForActiveShippingByPaymentId
- selectPaymentCostForActiveShippingByPaymentId
- isEveryAvailablePaymentFree
- selectIsEveryAvailablePaymentFree
- getSectionValidation
- selectSectionValidation
- showPickupPointMap
- shouldDisplayRemainingBasketValueForFreeShippingMessage
- addShippingInfo
- getShippingInfo