selectSectionValidation$(): Observable<TSectionValidation>¶
The selectSectionValidation$
method provides an observable stream that emits the current validation state of the payment section, allowing you to monitor validation changes in real-time.
Returned value¶
A returned value has a type of Observable<TSectionValidation>
where TSectionValidation
represents the TSectionValidation type, which emits the validation status of the payment section and updates whenever the validation state changes.
Example¶
In this example, we subscribe to the selectSectionValidation$
observable to track changes in the payment section's validation status.
useStorefront(async (storefront) => {
let basketShippingsApi = storefront.getApiSync('basketShippingsApi');
if (!basketShippingsApi) {
const featureSystemApi = this.getApiSync('FeatureSystemApi');
await featureSystemApi.registerDynamic('basket');
basketShippingsApi = storefront.getApiSync('basketShippingsApi');
}
const sectionValidation$ = basketShippingsApi.selectSectionValidation$();
sectionValidation$.subscribe((validationStatus) => {
console.log('Payment section validation status:', validationStatus);
});
});
Basket Shippings API methods reference¶
- get
- select$
- getAvailable
- selectAvailable$
- setPayment
- setPaymentData
- getSelectedPayment
- selectSelectedPayment$
- getActivePaymentCost
- selectActivePaymentCost$
- getPaymentChannelStrategy
- addPaymentChannelStrategy
- addPaymentInfo
- getPaymentInfo
- getSectionValidation