You want customers to land on a specific page after they log in, or you need to add a link or a script to the login page. Custom Login for WooCommerce gives you hooks for both, so you don’t have to edit plugin files. It also has a REST API endpoint that reads and updates the plugin’s settings from code.
This article covers the clwc_login_redirect filter, the clwc_after_login_form and clwc_login_footer actions, and the /settings REST API endpoint. It also lists three smaller hooks in a short table. Setting up the login page itself is covered in Getting started with Custom Login for WooCommerce.
Prerequisites
| Requirement | Details |
|---|---|
| Plugin | Custom Login for WooCommerce 1.0.3 or later, installed and active |
| WooCommerce | Version 6.0 or later, installed and active |
| Access | A way to add PHP code, such as a custom plugin or a child theme |
| REST API access | An account with the manage_woocommerce capability for the REST API endpoint |
How the hooks fit into the login page
The plugin serves your /login page from its own standalone template. That template doesn’t load your theme’s header or footer, and it doesn’t call wp_head() or wp_footer(). So a callback added to wp_head or wp_footer never runs on this page. Use the plugin’s own hooks below instead.
Keep in mind that the redirect filter runs on the form submission, while the two actions run when the login page is displayed.
Filter: clwc_login_redirect
This filter changes where a customer goes right after a successful login. It doesn’t run when a login fails.
apply_filters( 'clwc_login_redirect', $redirect_to, $user );
| Parameter | Type | Description |
|---|---|---|
$redirect_to | string | The URL the customer is about to be sent to |
$user | WP_User | The account that just logged in |
Return the URL you want. The starting value of $redirect_to is the redirect_to value passed to the login page, for example yourstore.com/login/?redirect_to=.... If there isn’t one, it’s your WooCommerce My account page URL.
Here’s what happens after your callback returns:
- WooCommerce’s own
woocommerce_login_redirectfilter runs next. Any callback on that filter sees your result and can change it again. - The plugin checks the final URL. If it points to another domain that WordPress doesn’t allow, the plugin sends the customer to My account instead.
- The plugin redirects the customer.
Example: send shop managers to the dashboard
add_filter( 'clwc_login_redirect', function ( $redirect_to, $user ) {
if ( in_array( 'shop_manager', (array) $user->roles, true ) ) {
return admin_url();
}
return $redirect_to;
}, 10, 2 );
The 10 is the callback’s priority, and the 2 tells WordPress your callback accepts two parameters. Without the 2, you don’t receive $user.
Actions: clwc_after_login_form and clwc_login_footer
Both actions let you print your own HTML on the login page. Neither one passes any parameters, so your callback needs no arguments. Output your content with echo.
| Action | Where it fires |
|---|---|
clwc_after_login_form | Directly after the closing </form> tag, still inside the login form panel. Content appears under the form. |
clwc_login_footer | After the whole two-panel layout, near the end of the page. Content isn’t inside either panel. |
Example: add a link under the login form
add_action( 'clwc_after_login_form', function () {
echo '<p><a href="' . esc_url( home_url( '/become-a-customer/' ) ) . '">Need an account? Apply here.</a></p>';
} );
Example: add a line of text to the page footer
add_action( 'clwc_login_footer', function () {
echo '<p style="text-align:center;">Need help? Call us on 1300 000 000.</p>';
} );
Other hooks on the login page
These hooks are smaller and less common. They work the same way as the actions and filter above.
| Hook | Type | What it does |
|---|---|---|
clwc_logout_redirect | Filter | Changes where customers go after they log out. Receives the default URL, which is /login/ with ?logged_out=true added, and returns the URL you want. |
clwc_login_head | Action | Fires inside the page’s <head> tag, after the plugin’s styles. Use it to add a stylesheet or meta tag. |
clwc_login_enqueue_scripts | Action | Fires near the end of the page. Use it to enqueue scripts for the login page. |
The login form also fires WooCommerce’s standard login hooks: woocommerce_login_form_start, woocommerce_login_form, and woocommerce_login_form_end. That’s why most CAPTCHA and security plugins that work on the WooCommerce login form also work here.
REST API: settings endpoint
The plugin has one REST API endpoint for its settings. It lets you read the current settings or update them from code, for example when you set up many stores from one script.
/wp-json/clwc/v1/settings
| Method | What it does |
|---|---|
GET | Returns all settings, plus the list of rotation_items |
POST | Updates the settings you send and returns all settings |
Who can use it
Both methods need a logged-in account with the manage_woocommerce capability. That includes administrators and shop managers. Anyone else gets a 401 or 403 response.
For a request from the browser while you’re logged in, send the X-WP-Nonce header with a wp_rest nonce. For a request from outside WordPress, use an application password with basic authentication.
Read the settings
curl -u "admin:APPLICATION_PASSWORD" https://yourstore.com/wp-json/clwc/v1/settings
The response is a JSON object. Any setting you haven’t saved yet comes back with its default value, except logo_url, which is missing from the response until you save a logo URL.
Update the settings
Send a JSON body with only the fields you want to change. Fields you leave out stay as they are.
curl -X POST -u "admin:APPLICATION_PASSWORD" \
-H "Content-Type: application/json" \
-d '{"template":"template-2","button_bg":"#e11d48","login_heading":"Welcome back"}' \
https://yourstore.com/wp-json/clwc/v1/settings
From the browser, you can use wp.apiFetch in the same way:
wp.apiFetch( {
path: '/clwc/v1/settings',
method: 'POST',
data: { login_button_text: 'Sign in' },
} );
The plugin cleans every value before it saves it. A value of the wrong kind is skipped or saved as empty, and the request still succeeds.
| Fields | Accepted values and handling |
|---|---|
Color fields: left_panel_bg, left_panel_text, right_panel_bg, right_panel_text, button_bg, button_text, button_hover_bg, link_color, link_hover_color, input_border, input_focus, promo_button_bg, promo_button_text_color, promo_button_hover_bg, promo_button_border | A hex color such as #3b82f6. Anything else is saved as empty. |
URL fields: logo_url, promo_button_url | A valid URL. The plugin cleans it as a URL before saving. |
template | One of template-1, template-2, template-3, template-4, template-5. Other values are ignored. |
promo_enabled, enable_rotation | yes or no. Other values are ignored. |
mobile_promo_display | hide or stack. Other values are ignored. |
Text fields: login_heading, email_label, password_label, remember_label, login_button_text, lost_password_text, promo_heading, promo_button_text | Plain text. HTML tags are removed. |
promo_content | Text with basic HTML, such as <br>, <p>, and <strong>. Unsafe HTML is removed. |
rotation_items | A list of items. Each item can have heading, content, button_text, button_url, and image_url. Sending this field replaces the whole saved list. |
Troubleshooting
manage_woocommerce capability. Check that your application password belongs to an administrator or shop manager. For requests from the browser, check that you send a valid X-WP-Nonce header.woocommerce_login_redirect is changing the URL after yours. Also check that the URL belongs to your own site. The plugin sends customers to My account when the final URL points to a domain WordPress doesn’t allow.add_filter() call needs 10, 2 at the end, so WordPress passes both parameters to your function.#3b82f6 or #fff. Color names like red and values like rgb(0,0,0) are saved as empty.clwc_login_head for the <head> tag, and clwc_login_footer or clwc_login_enqueue_scripts for the end of the page.Frequently asked questions
woocommerce_login_redirect.manage_woocommerce capability, and shop managers have it by default.functions.php. Don’t add it to the plugin’s own files, because plugin updates overwrite them.Need help?
Custom Login for WooCommerce is a premium plugin, so if you need help with a specific customization, open a support ticket and our team can point you to the right hook for your use case.

