1 min read
Store Availability
Last Updated - Platform 25.0 - SDK 20.0When using the Store Finder or Store Details with a variant (SKU) the app uses the stores/availability
API using the StoreAvailabilityService
to present stock.
Product Details Link
Store Availability is disabled by default as it requires backend support. When enabled, the Store Availability feature is accessed from the Product Details screen via a link that forwards the product and current variant selection.
Tapping the link will present the Variant Selector if a product variant is not already selected on the Product Details screen.
Enable Store Availability
To enable the link, set the isStoreAvailabilityEnabled
setting to true
.
- Open your
AppModule
to thesetUpDependencies
function. - Enable the
isStoreAvailabilityEnabled
setting.
Settings.ProductDetails.isStoreAvailabilityEnabled = true
If you have previously customised the Product Details screen, or want to customise the link, you can override the link view using a custom data source.
class CustomProductViewDataSource: PoqProductViewDataSource { let storeAvailabilityLinkView = CustomStoreAvailabilityLinkView() override func makeViews(for product: ProductDetailsViewData) -> [UIView] { var views = [UIView?]() ... views.append(makeStoreAvailabilityView(with: product)) ... return views.compactMap { $0 } } override func makeStoreAvailabilityView(with product: ProductDetailsViewData) -> UIView? { storeAvailabilityLinkView.delegate(to: delegate) storeAvailabilityLinkView.setup(with: product) return storeAvailabilityLinkView }}