Replace hardcoded store ID = 1 with either input argument or detected default store ID.

@tim-bezhashvyly it seems like the else branch is unnecessary with the logic you've introduced?