Assigning a membership to a user requires that we have a user to assign that access to. The user must either be logged in or create an account.
WP-Members Memberships for WooCommerce auto-detects if a user’s cart has a linked membership and if it does, it will automatically disable guest checkout for that order. However, if your only products are memberships or products that require the user to be registered, you may wish to disable guest checkout in your WooCommerce settings.
To disable guest checkout, go to WooCommerce > Settings and select the Accounts & Privacy tab. Uncheck “Allow customers to place orders without an account.”
Note that the other Guest Checkout and Account Creation settings are optional. However, allowing guests to log in during checkout and allowing customers to create an account during checkout do smooth out the user experience.