How can I load a Store by user ID? I am building a multi-seller commerce site, where a user can register and sell their product.  I need to display a menu link if the user is anonymous to "become a seller", where they are directed to log in and a create store form.

If the user is logged in, I want to display a menu link that displays "My Store" if they previously created a store.  To determine if they have a store, how can I load a store via their user ID?

I have been unable to find an example where someone can load a user's store.
The user ID is saved on the store when it's created. Therefore you can load it with code similar to the following one.

$store = \Drupal::entityTypeManager()-&gt;getStorage('commerce_store')-&gt;loadByProperties(['uid' =&gt; \Drupal::currentUser()-&gt;id()]);


That will load the store based on the currently logged-in user.