Store Selector
Last Updated - Platform 25.0 - SDK 20.0The Store Finder can be used in selector
mode directly from code to allow a feature to select a store ('Store Selector').
Last Selected
The Store Selector comes with a more intuitive built-in replacement for the very old and custom 'Favourite Store' feature. When a store is selected it is stored as the 'last selected store'. Reopening the Store Selector should preselect the last selected store by default.
The last selected store can be accessed by any feature using StoreReference.selected
.
If clients want to maintain a 'Favourite Store' customisation they can customise the StoreSelectionRepository
and add a custom route to the Store Selector as favourite store selector that does nothing else.
Usage
To use the Store Selector use the StoreSelectorCoordinator
and implement the completion closure to work with the selected store.
The selector can also be used with a product for Store Availability whilst selecting making it useful BOPIS.
let viewController = Container.shared.coordinators.storeSelector()?.makeStoreSelectorViewController( input: .init( source: type.rawValue, productId: .init(productId: item.productId, listingId: item.listingId, variantId: item.sku), product: item.product ), selected: nil) { result in guard let result else { return } print(result.store) print(result.stock) // The Store Selector also returns the stock of the variant in that store.}
navigator.navigate(to: viewController, isModalInNavigationController: false)