1. Home
  2. Knowledge Base
  3. WooCommerce Private Store
  4. Developer Documentation

Actions and Filters

There are a number of hooks provided in WooCommerce Private Store which let you customize the plugin’s behavior.

Please note that this code is aimed at developers and if you don’t know how to use it then you should ask your developer. If you don’t have one, we recommend posting a job on Codeable. We have partnered with them to provide plugin customizations for our customers.

We've partnered with Codeable to provide our customers with expert help if required.



You can use this filter to override whether the store is currently locked (or unlocked). Return true to indicate that the store is locked, and false for unlocked:

add_action( 'wc_private_store_lock_override', 'wcps_lock_override' );
function wcps_lock_override( $is_locked ) {
    if ( $xyz ) {
        return false;
    return $is_locked;


This action fires before the store login form is output. You could use it to add additional markup around the form. E.g:

add_action( 'wc_private_store_before_login_form', 'wcps_before_login_form' );
function wcps_before_login_form() {
    echo '<div class="container col-12">;


This action fires after the store login form. E.g:

add_action( 'wc_private_store_after_login_form', 'wcps_after_login_form' );
function wcps_after_login_form() {
    echo '</div>;


This filter allows you to modify the HTML for the store login form before it’s displayed. E.g:

add_filter( 'wc_private_store_login_form', 'wcps_login_form' );
function wcps_login_form( $form_html ) {
    // do something with form
    return $form_html;


The store login is handled using a cooke which is set when the user enters the correct password. You can set the cookie expiry time (i.e. how long the user remains logged in) from the plugin settings page under WooCommerce → Settings → Products → Private Store. However, if you want more fine-grained control, you can use this filter.

The return value should be Unix timestamp in seconds since the epoch. The easiest way to set this is to use the time() function and add the number of seconds you want to it. For example, to expire the cookie after 4 hours, add this code to your theme:

add_filter( 'wc_private_store_password_expires', 'wcps_password_expiry' );
function wcps_password_expiry( $expires ) {
    return 4 * HOUR_IN_SECONDS;


The filter allows you to override the URL the user is redirected to after successfully logging in to your store. You can set a global redirect from the plugin settings page, but if you want to do something more custom, use this filter.

add_filter( 'wc_private_store_login_redirect', 'wcps_login_redirect' );
function wcps_login_redirect( $url ) {
    // set url as required
    return $url;

Related Articles

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