• Resolved vishalsanghi

    (@vishalsanghi)


    Hello I have doubt any help will be much appreciated since I dont know the coding much i just want to seek help how to do it.

    Below is the code from form-login.php. I want to change in this function few parameters and want to put in function.php (my custom functions) to avoid modifying the core files. Please help.

    Current
    <?php wc_print_notice( apply_filters( ‘woocommerce_checkout_login_message’, __( ‘Returning customer?’, ‘woocommerce’ ) ) . ‘ ‘ . __( ‘Click here to login’, ‘woocommerce’ ) . ‘‘, ‘notice’ ); ?>
    </div>

    What I want – I am changing messages and class
    <?php wc_print_notice( apply_filters( ‘woocommerce_checkout_login_message’, __( ‘Returning customer?’, ‘woocommerce’ ) ) . ‘ ‘ . __( ‘Click here to login’, ‘woocommerce’ ) . ‘‘, ‘notice’ ); ?>
    </div>

    • This topic was modified 5 years, 7 months ago by vishalsanghi.
    • This topic was modified 5 years, 7 months ago by vishalsanghi.
    • This topic was modified 5 years, 7 months ago by vishalsanghi.
    • This topic was modified 5 years, 7 months ago by vishalsanghi.
    • This topic was modified 5 years, 7 months ago by vishalsanghi.
Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Support Missy a11n

    (@m155y5)

    Automattic Happiness Engineer

    Hi @vishalsanghi

    You should be able to add this snippet to your custom functions to change that:

    add_filter( 'woocommerce_checkout_login_message', 'mycheckoutmessage_return_customer_message' );
     
    function mycheckoutmessage_return_customer_message() {
    return '<span class="login-message">Have you shopped with us before?</span>';
    }
    

    Of course, you can change the span class, etc. to whatever html you need there. ??

    Thread Starter vishalsanghi

    (@vishalsanghi)

    Thank you I will try this today and let you know

    Thread Starter vishalsanghi

    (@vishalsanghi)

    I checked on it but unable to work on this. There is one more text “click here to login” which I am not able to control from your code. Can you help me with this. Basically i want to control “Returning customer?” and Class name and then the “click here to login”

    <div class="woocommerce-form-login-toggle">
    	<?php wc_print_notice( apply_filters( 'woocommerce_checkout_login_message', esc_html__( 'Returning customer?', 'woocommerce' ) ) . ' <a href="#" class="showlogin">' . esc_html__( 'Click here to login', 'woocommerce' ) . '</a>', 'notice' ); ?>
    </div>
    Plugin Support Missy a11n

    (@m155y5)

    Automattic Happiness Engineer

    Okay, so I don’t think you’ll be able to edit that text with a function because that “Click here to login” section is hard-coded into the template. You can, however, edit that entire template by creating a copy of it inside of your child theme. The file you’ll want to edit is checkout/form-login.php. From there, you’ll be able to edit the html quite easily.

    Here’s our documentation on how to edit template files: https://docs.woocommerce.com/document/template-structure/

    • This reply was modified 5 years, 7 months ago by Missy a11n.
    Plugin Support Missy a11n

    (@m155y5)

    Automattic Happiness Engineer

    When you edit the template file, you’ll want to replace this part:

    <div class="woocommerce-form-login-toggle">
    	<?php wc_print_notice( apply_filters( 'woocommerce_checkout_login_message', esc_html__( 'Returning customer?', 'woocommerce' ) ) . ' <a href="#" class="showlogin">' . esc_html__( 'Click here to login', 'woocommerce' ) . '</a>', 'notice' ); ?>
    </div>

    With something like this in order to add your own CSS classes:

    <div class="woocommerce-form-login-toggle">
    	<?php wc_print_notice( apply_filters( 'woocommerce_checkout_login_message', '<div id="yourloginclassnamehere">' . esc_html__( 'Have you shopped with us before?', 'woocommerce' ) ) . '</div>' . ' <a href="#" class="showlogin yourcustomclassnamehere">' . esc_html__( 'Well login, then!', 'woocommerce' ) . '</a>', 'notice' ); ?>
    </div>
    Plugin Support Missy a11n

    (@m155y5)

    Automattic Happiness Engineer

    We haven’t heard back from you in a while, so I’m going to go ahead and mark this thread as resolved. If you have any other questions please feel free to start a new thread.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Change Checkout Login Message and Class’ is closed to new replies.