Skip to main content
Version: 5.6

Store Configuration

Set Price Book

To set the price book, you can use this code:

import mealzcore

Mealz.shared.basket.setPriceBook(priceBookId: pricebook.rawValue)

Set Store

For Mealz to work properly, a store is mandatory. Without a store, we cannot generate a Recipe price, see the products, or purchase anything.

However, Recipe Cards, & our catalog, CAN be shown without a store. When the user clicks on a Recipe Card, we prompt the user to select a store. You must pass in a function for us to navigate to your Store Selector.

public class MealzManager: ObservableObject {
public static let sharedInstance = MealzManager()

private init() {
// set the redirection when the user has not selected a store
Mealz.shared.user.setStoreLocatorRedirection { yourFunctionToChangeStore() }

Mealz.shared.Core(init: { coreBuilder in
coreBuilder.sdkRequirement(init: { requirementBuilder in
requirementBuilder.key = key
})
})
}
}

Force Store Update Callback

When using our SDK without a store, your users will be prompted by the "Select a Store" page. Occasionally, they will decline this popup. To prevent infinite loading or empty views that are blocked due to the user being storeless, we have created a function SetForceStoreUpdateCallback.

This function should navigate the user back to a certain page or a simple "return" to leave the current Mealz view they clicked.

Mealz.shared.environment.setForceStoreUpdateCallBack(callBack: { storeId in

})