selectSectionValidation$(): Observable<TSectionValidation>¶
The selectSectionValidation$
method allows you to observe the validation state of the shipping section of the basket.
Returned value¶
A returned value has a type of Observable<TSectionValidation>
where TSectionValidation
represents the TSectionValidation model.
Example¶
In this example, we make a basketShippingsApi
call to observe the validation state of the shipping section of the basket.
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 sectionValidation$ = basketShippingsApi.selectSectionValidation$();
sectionValidation$.subscribe((validationState) => {
console.log('Shipping section validation state:', validationState);
});
});
Basket Address API methods reference¶
- get
- select
- setShipping
- setPickupPoint
- getSelectedShipping
- selectSelectedShipping
- getAvailableShippingCountries
- selectAvailableShippingCountries
- getSelectedShippingCountry
- selectSelectedShippingCountry
- setCountry
- getPaymentCostForActiveShippingByPaymentId
- selectPaymentCostForActiveShippingByPaymentId
- isEveryAvailablePaymentFree
- selectIsEveryAvailablePaymentFree
- getSectionValidation
- addMap
- showPickupPointMap
- shouldDisplayRemainingBasketValueForFreeShippingMessage
- addShippingInfo
- getShippingInfo