1. Knowledge Base
  2. WooCommerce Private Store
  3. Getting Started

Private store login shortcode

WooCommerce Private Store comes with a simple shortcode that you can use to add a password entry form to your site. You can use this shortcode in any location, including in sidebar widgets, Gutenberg blocks, and a text/code block in any page builder plugin.

How to add a WooCommerce store login form

You can add a login form anywhere on your site by adding the shortcode: [store_login]. If you’re using the Gutenberg editor then you can add this to a ‘Shortcode’ or ‘Paragraph’ block.

By default, this will create a login form with the text that you added on the plugin settings page. If you’re planning to add different login forms to different parts of your site, then you can also configure the text for the individual form within the shortcode. For example:

[store_login message="Welcome to my store. Enter the password to login."]

There are 3 shortcode options:

  • message – The message to display above the login form prior to login.
  • unlocked_message – The message to display after the store is unlocked. When the store is unlocked, this message is displayed instead of the login form. For example, if you use the shortcode in a sidebar, the sidebar widget will probably be visible after login, so you might want to show a message here. You can set this to false to hide the message – e.g. [store_login unlocked_message="false"]
  • visit_store – When the store is unlocked, a link is displayed to take the user to the main shop page. The default text is “Visit Store” but you can customise this by setting this shortcode option. E.g. [store_login visit_store="Enter Shop"]. You can also set this to false to hide this link. By default, this link will take the customer to the main shop page. However, if you have set a custom redirect URL in the plugin settings, they will be taken to this page instead.

Another example:

[store_login message="Welcome to our store. Enter the password to login." unlocked_message="Welcome to the members-only store." visit_store="Visit Shop"]

Can customers log out of the private store?

Please see our separate article about logging out of the WooCommerce private store.

Still need help?
If searching the knowledge base hasn't answered your question, please contact support.

Related Articles