Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
How do I go about programtically obtaining the store Guid?
For the moment I have it hardcoded, but this brings in some problems whenever I deploy my site.
I have tried looking at the StoreService, but I can't seem to get anything but a StoreReadOnly object out of it. Any ideas?
Your site root node should have a store picker on it with the alias of store. To get the store at any point in the site then, you can lookup that store property (which via a value converter returns a StoreReadOnly entity).
var store = currentPage.Value<StoreReadOnly>("store", fallback: Fallback.ToAncestors);
Or, if you are using models builder, you should be able to get it from your homepage node
var store = currentPage.AncestorOrSelf<HomePage>().Store;
From the store object, you can then get the ID from store.Id.
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted