Home › Forums › WoodMart support forum › How can i redirect the user in other url when he click create an accound › Reply To: How can i redirect the user in other url when he click create an accound
November 30, 2021 at 3:22 pm
#335875
Luke Nielsen
Keymaster
Hello,
To be able to change the redirect link, try to add this code to the functions.php file in your child theme. Insert your link into the value of the “$account_link” variable.
https://monosnap.com/file/rnZWy1Y1bVhoMrExB0VcE1vJcXo607
if ( ! function_exists( 'woodmart_sidebar_login_form' ) ) {
function woodmart_sidebar_login_form() {
if ( ! woodmart_woocommerce_installed() ) {
return;
}
$settings = whb_get_settings();
$login_side = isset( $settings['account'] ) && $settings['account']['login_dropdown'] && $settings['account']['form_display'] == 'side';
$account_link = ' Enter your link here. ';
$page_id = woodmart_get_the_ID() ? woodmart_get_the_ID() : get_option( 'woocommerce_myaccount_page_id' );
$redirect_url = apply_filters( 'woodmart_my_account_side_login_form_redirect', get_permalink( $page_id ) );
$wrapper_classes = '';
if ( 'light' === whb_get_dropdowns_color() ) {
$wrapper_classes .= ' color-scheme-light';
}
$position = is_rtl() ? 'left' : 'right';
$wrapper_classes .= ' wd-' . $position;
if ( ! $login_side || is_user_logged_in() ) {
return;
}
woodmart_enqueue_inline_style( 'header-my-account-sidebar' );
?>
<div class="login-form-side wd-side-hidden<?php echo esc_attr( $wrapper_classes ); ?>">
<div class="widget-heading">
<h3 class="widget-title"><?php esc_html_e( 'Sign in', 'woodmart' ); ?></h3>
<div class="close-side-widget wd-action-btn wd-style-text wd-cross-icon">
<a href="#" rel="nofollow"><?php esc_html_e( 'close', 'woodmart' ); ?></a>
</div>
</div>
<?php woocommerce_output_all_notices(); ?>
<?php woodmart_login_form( true, $redirect_url, false, true, $redirect_url ); ?>
<div class="create-account-question">
<p><?php esc_html_e( 'No account yet?', 'woodmart' ); ?></p>
<a href="<?php echo esc_url( add_query_arg( 'action', 'register', $account_link ) ); ?>" class="btn btn-style-link btn-color-primary create-account-button"><?php esc_html_e( 'Create an Account', 'woodmart' ); ?></a>
</div>
</div>
<?php
}
add_action( 'woodmart_before_wp_footer', 'woodmart_sidebar_login_form', 160 );
}
Kind Regards